A Comp-Sci Saga
MySQL migration: Windows > Ubuntu

So, at work, I’ve been trying to migrate all my existing work, projects, services, etc.. from a Windows Server 2008 machine to a fresh install of Natty Ubuntu.  Developing on windows, even with cygwin was getting to be too much of a hassle for me.

However, when I went to migrate the MySQL database, I ran into a minor difficulty that took me nearly a full afternoon to figure out.

I started by running a simple mysqldump command on the windows machine

cd “C:\Program Files (x86)\MySQL\MySQL Server 5.1\bin"

mysqldump.exe -u root -p databaseName > databaseName.sql

I quickly did an ‘scp’ to the Ubuntu box and then ran the following commands:

mysql -u root -p databaseName < databaseName.sql.

MySQL then told me the file contained a syntax error.  This seemed impossible, as it was generated by the MySQL dump command on the windows server. I assumed the problem had something to do with the formatting of the text file (e.g. those stupid ^M characters).

What fixed the problem however, was running a refresh command BEFORE doing the dump.  The problem-solving, fix-all command is below:

mysqladmin.exe -u root -p refresh