Converting a database from latin1 to utf8

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Converting a database from latin1 to utf8

Post by onion2k »

Is there a way to convert the character set of an entire database without having to dump it all, change the settings in the dump file, and rebuild it?

I've written a script that can scan through the database changing all the collations, and I think I can do the same for column charsets, but is there a way to change the charset of a table using ALTER TABLE rather than dropping it and then using CREATE TABLE? I don't really want to have to rebuild this whole thing from a backup because it's 300 very large tables.

This is in MySQL 4.1.

(I've read:

http://dev.mysql.com/doc/refman/4.1/en/ ... rsion.html
http://www.oreillynet.com/onlamp/blog/2 ... in1_t.html

...any other links appreciated though)
Post Reply