Moving MySQL Database from Windows to Linux RedHat

The question is can it be done. My reply is yes… terms and condition applies.

Terms and conditions :
1. The mySQL DBMS for both the server must use same version.
2. Database only uses MyISAM tables, strictly no INNODB please.
3. Refer to line 1 and 2 😛

Workflow :
1. Stop the mySQL service on the windows server. Make sure that the mySQL service is really dead.
2. Go to the mysql database data path, Windows usually will be in “C:MySQLData”.
3. Zip the directory/folder which shares the same name as the database that you are about to copy over.
4. After that, copy the file over to the Linux server. *use WinSCP at your windows machine if you have SSH installed in your Linux machine.
5. From the linux machine, stop the mySQL service. Yeah you need to make sure it is really dead.
6. Unzip the file and place it into the data path of mysql, my server database location it is at “/var/lib/mysql/data” .
7. Change the ownership for the newly extract directory folder to mysql . Update proper files or folders permission too.
8. Re-initiate the mySQL service at the linux server.
9. Use the mysql shell to test :
shell > mysql -uroot -ppassword
mySQL shell > use dbname
database changed
mySQL Shell > select * from table_name;

10. Should step 9 gives you the actual data, give your self a pat on your shoulder. Task is done.

**Fine notes :
My server environment :

Windows Server is using Server version: 5.0.37-community-nt MySQL Community Edition (GPL) .
Linux Server is using Server version: 5.0.45-community MySQL Community Edition (GPL) .
Both hardware is using IA32 CPU aka Intel Processor , or 80×86 little endian .

3 thoughts on “Moving MySQL Database from Windows to Linux RedHat

  1. why not mysqldump then import? will it be easier? transfer via a zipped .sql can save bandwidth too.

    OOT: the captcha sucks, please change another plugin or anything.

  2. GuTi : Yeah thank you for highlighting mysqldump 😀 Unfortunately at that time, we are too lazy to do the mysqldump thingy. So we want to satisfy our curiosity that mysql raw data and schema can be moved from one location to another without using mysqldump, the experiment did paid off.. proves that even ftp from windows to linux OS, mysql db still runs 😀

    Captcha, wait till got too many spambot can bypass… then i will change LOL

  3. Hum. This would be helpful apart from the blindingly obvious self-contradiction. You say “The mySQL DBMS for both the server must use same version.” Then you list your server environments as

    Windows Server is using Server version: 5.0.37-community-nt MySQL Community Edition (GPL) .
    Linux Server is using Server version: 5.0.45-community MySQL Community Edition (GPL) .

    Doesnt look like the same version? Maybe you mean same major version? i.e MySQL 5.0 ?

    Steve – Thanks for your correction, major version will be more percise.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.