I would like to copy a MySQL database form Linux to Windows, from a little research I found this url http://www.cyberciti.biz/tips/howto-copy-mysql-database-remote-server.html where the author says we could copy MySQL Database using the following command in Linux
Linux to Linux
mysqldump -u username -p 'password' db-name | ssh [email protected] mysql -u username -p 'password' db-name
Is there a command for copying MySQL database from Linux to Windows?
-
Do you mean on the same machine?Roney Michael– Roney Michael2013年03月04日 18:07:50 +00:00Commented Mar 4, 2013 at 18:07
-
dump db on one server, import dump on other server: dev.mysql.com/doc/refman/5.1/en/mysqldump.htmlMarc B– Marc B2013年03月04日 18:08:19 +00:00Commented Mar 4, 2013 at 18:08
-
It means from a remote server via ssh console....you can do it in any of the pc with an ssh-console enabledRobert Rozas– Robert Rozas2013年03月04日 18:08:49 +00:00Commented Mar 4, 2013 at 18:08
-
@RoneyMichael from a Linux Machine to a Windows Machineunknown– unknown2013年03月04日 18:32:27 +00:00Commented Mar 4, 2013 at 18:32
-
@MarcB thanks you, I do know this but is there a single command to do this from Linux to Windows just like from Linux Machine to an other Remote Linux Machine?unknown– unknown2013年03月04日 18:34:56 +00:00Commented Mar 4, 2013 at 18:34
1 Answer 1
Linux -> Windows you have two obvious options.
Setup a SSHD on your Windows machine and use the above command (mysql binary would need to be in your search path under Windows).
Configure your root (or similar privileged account) to access your Windows MySQL host over network then do:
mysqldump -u username -p 'password' db-name | mysql -h windowsip -u username -p 'password' db-name
Unfortunately with #2, if you have complex indicies (or huge tables) you'll have issues with net_read_timeout
on your Linux host. For most situations I would expect this to just work, though.