smetterd
asked on
How to convert a mysql database to utf-8
I have a dump file of my Moodle 1.8 instance. The instance was on a server that is now physically dead. I am trying to move it to a Moodle 1.9 server, but when I attempt to upgrade, I get a message stating that all my tables have to be in UTF-8 before proceeding. How can I convert the entire dump file to UTF-8?
The most comfortable way would be to setup mySQL with UTF-8 as global default and restore your dump then. Make sure first that there are no commands in your dump file to create your tables in another codepage.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Is this allowable?
ALTER DATABASE database1
DEFAULT CHARACTER SET utf8
COLLATE utf8_general_ci;
ALTER DATABASE database1
DEFAULT CHARACTER SET utf8
COLLATE utf8_general_ci;
ASKER
ALTER DATABASE harlinge_drcmdl
DEFAULT CHARACTER SET utf8
COLLATE utf8_general_ci;
Worked perfectly! Thank you!
DEFAULT CHARACTER SET utf8
COLLATE utf8_general_ci;
Worked perfectly! Thank you!
If your case is that you import that dump file to a new DB, but it isn't UTF-8 encoding yet, then you can import again with this command
mysql -h host -u username -p password --default_character_set utf8 database < your_dump_file