1

I am fairly new to mysql...be gentle. I am trying to move mysql db from linux box to windows box where I do all the development.

Can someone tell, or reference me, how to do it step by steps?

Thanks

ultraman
  • 129
  • 4
  • 10

2 Answers2

6

Easiest thing to do would be to do a mysqldump on your linux box, and then import said dump into your local windows database.

First, the mysqldump (docs: http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html)

mysqldump -u [username] -p [any other options desired] [database name] > dump.sql

The above creates a file called "dump.sql" in the directory you ran that in. Next grab that dump.sql file from your linux box and bring it over to your windows box. Now, you can either use a GUI to import the dump (like navicat or sqlyog, or even phpmyadmin if you happen to have that handy), but the way you normally do this from the command line (on linux, you may have to make an adjustment on windows) is:

mysql -u [username] -p < dump.sql

And that's it! The above line pipes the dump.sql file into mysql. The dump file is nothing more than a bunch of SQL statements, which is why the above works. Sorry for not being able to provide windows-specific command line instructions, it's been a while since I've worked with windows :) Hope that helps.

Ian Selby
  • 332
  • 1
  • 4
  • so the dump file will contain all the populated tables? – ultraman Jul 27 '09 at 17:30
  • By default, yes... make sure you take a look over all the flags in the docs tho, there are ways to turn this off / on (or specify only certain tables be dumped, etc.) Easiest way to confirm everything worked right in the dump is to simply open the dump.sql file and see what it dropped in there. – Ian Selby Jul 27 '09 at 17:36
  • 1
    As Ian implied, the dump is just a text file full of sql statements that you can view with pretty much any text editor. – Kyle Brandt Jul 27 '09 at 18:05
1

You can try copying MySQL database files. This should work: they're often binary compatible. On Linux, they're located in /var/lib/mysql

kolypto
  • 10,738
  • 12
  • 51
  • 66