Importing mysql dumps from phpMyAdmin

Monday, 30. March 2009 13:12 - daniel - Other - 0 Comments


Every time I move a website from a shared hosting account to my own server I have to export the databases with phpMyAdmin. But since these dumps can get pretty big, it's not a good idea to import then with phpMyAdmin. Usually you use the command line mysql client. But here comes the problem: Database dumps from phpMyAdmin are usually UTF8, but mysql expects ISO-8859-1 or something else and special chars like ä or ü end up as weird signs.

I've done some crazy shit before to fis this, like manually replacing those occurences, or converting the dump with iconv. I guess I should have read the man page more carefully, because mysql has an option to tell it which charset your file is in: default_character_set

Use mysql --default-character-set utf8 < dump.sql to im import your dump and everything works fine.



Comments