Migrating Drupal using phpmyadmin and CLI

Posted on November 18, 2006
I recently had to migrate a Drupal site from a CPanel site, to a host where I had SSH access. The only logical way I could extract the database was using phpmyadmin’s export function. Then I had to import it at the new host using cat … | mysql. However, even though the fields aren’t unicode, they contained unicode chars. This caused a real headache when I did the import, as there were garbage chars in the resulting table.

This is a similar/same problem.

In the end, I found if you define a default character set then all things fall into place.
cat localhost.sql | mysql -uUSER -h mysql.HOST -p --default-character-set=utf8

Just a note for the files really.

powered by performancing firefox