Locally I do this to dump and move a database, upgrading silverstripe 2.3 to 2.4:
mysqldump --opt --default-character-set=latin1 --skip-set-charset --user=$root -p$password $oldDatabase -r db.sql
iconv -f LATIN1 -t UTF8 db.sql > db_utf.sql
CREATE DATABASE $newDatabase CHARACTER SET utf8 COLLATE utf8_swedish_ci; FLUSH PRIVILEGES; GRANT ALL PRIVILEGES ON $newDatabase . * TO '$newUser'@'localhost'; FLUSH PRIVILEGES;
SET NAMES utf8; SOURCE db_utf.sql;
And it works, but on the server Ubuntu 8.04, with mysql Ver 14.12 Distrib 5.0.51a.
I get crazy √∏
characters instead of øæåØÆå
.
Anyone know where I've gone wrong?
mysql_query("SET NAMES 'utf8'");
after mysql_connect – Overweigh