On Tuesday, 10 April 2012 22:17:46 UTC+2, etipaced wrote:
If these were only passwords... :-/
You can fix this with either mysql alone, or a shell. Either way though you're going to need to go through some trial and error and if you get stuck know that a mysql forum/irc channel will give you more chances of finding help.
Mysql alone
The dump file you've got is going to have charset statements in it that don't (by the sounds of it) match the charset of the dump file itself - so remove them:
CREATE TABLE `foos` (..PRIMARY KEY (`id`)) ENGINE=InnoDB **DEFAULT CHARSET=utf8**
import the dump file specifying the charset you think the file is:
$ mysql --default-charset=latin1 wrongcharsetdb < dumpfile.sql
if you can query the db (directly with mysql on the cli) and see the right values, you're half way there.
It's been a while since I managed to put myself in the position your in but then, in principle:
$ mysqldump --default-character-set=wrongcharset mydb > dumpfile.sql
$ mysql --default-character-set=utf8 mydb < dumpfile.sql
simply because you'll likely do these steps several times - it's easier if you use 2 dbs so that you don't need to keep re-importing your "wrong db" when it's in the right state.
Using a shell
Here's a shell I wrote a long time ago to correct charset problems: https://github.com/AD7six/mi_development/blob/04dd588ce9944a67985c1fd206a7dd202f853e3b/vendors/shells/fix_charset.php
Which proved at the time to be quite handy but slow.
And here's the commit where I deleted it because it didn't do anything you couldn't do with mysqldump alone: https://github.com/AD7six/mi_development/commit/086f18e57949c87470c8f755218d8d50f28a5d53
hth,
AD
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment