Convert a MySQL database to utf8
Convert the charset of the database (this won't convert its tables)
ALTER DATABASE '<MY DATABASE>' CHARSET=utf8
First, get all the table names from your database:
SELECT TABLE_NAME FROM `TABLES` WHERE `TABLE_SCHEMA` LIKE '<MY DATABASE>'
Then, for each table:
ALTER TABLE `<MY TABLE>` CONVERT TO CHARACTER SET utf8;
There's no need to use iconv, php, ruby gems, bash scritps, special procs, just that.
- Tested with MySQL 5.5
Written by Anderson Freitas
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#N
Authors
Related Tags
#n
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#