Moving MySQL Databases
When you move MySQL databases as described here, make sure you don’t move the ib_ files, but also make sure to move the ib files, like ibdata1. Also, move the mysql subdirectory into the new location. Just did this – worked great. Now I have RAID5’d databases.
I was doing this to convert an SQLite version of my Amarok database to a MySQL implementation.
cd ~/.kde/share/apps/amarok && sqlite3 collection.db .dump | grep -v "COMMIT;" | grep -v "BEGIN TRANSACTION;" | perl -pe 's/INSERT INTO \"(.*)\" VALUES/INSERT INTO \1 VALUES/' > amarok
I also had to do this because of a maximum key length problem, which I found the solution to here:
vim amarok
:%s/VARCHAR(1024)/VARBINARY(255)/g
And I finished it off with this:
mysql -p -u root amarok < amarok
Now, I’ll never lose the database even if I reinstall Linux.
