Which is the fastest way to transfer mysql databases from xampp on Windows to a MySql server on Ubuntu?
2 Answers
Xampp comes packaged with PhpMyAdmin, if memory serves. Use that web interface to export your database tables in .sql format.
If you have PhpMyAdmin on the Ubuntu machine as well, you can use that to import the exported .sql file there.
If you don't, you can do the import from the command line.
Create an empty database on the Ubuntu machine with: mysql -u username -p -e "CREATE DATABASE databasenamehere;
After that, you can import the .sql file you made earlier using
mysql -u username -p databasenamehere < databasedump.sql
Thanks to xofer for the comment below, I updated my answer.

- 3,072
- 12
- 19

- 9,045
- 3
- 42
- 58
-
1+1 If you have phpMyAdmin installed on the Ubuntu box, and the exported file size is not too big (use zip compression when you export) you can use the import tab. Either way though, **you need to create an empty database first**. From the command line (before running the mysql command in kenny.r's answer) run `mysql -u USER -p -e "CREATE DATABASE upgrade_wordpress;"` – xofer Sep 12 '11 at 18:40
-
Ok Maybe I've explained it wrong. I already know how to export and import the databases from phpMyAdmin. What I want is to bypass this method. Is it possible? – albertopriore Sep 13 '11 at 21:14
-
What I want to know is that If I have the directory in windows \xampp\mysql\data is it possible to use the same directory under a Ubuntu machine (I've the Ubuntu machine in Virtualbox under Windows XP). – albertopriore Sep 14 '11 at 08:42
from the command line:
mysqldump -u username -p password database_name > database_name.sql
then copy the .sql to the ubuntu server and then:
mysql -u username -p password database_name < database_name.sql
if import script does not run, you can remove the password from that script. The password prompt will be appear later, and you can insert your password. This method can be used for larger data.
mysql -u username -p database_name < database_name.sql
Enter Password :

- 3
- 3

- 801
- 1
- 7
- 15