3

Which is the fastest way to transfer mysql databases from xampp on Windows to a MySql server on Ubuntu?

albertopriore
  • 131
  • 1
  • 3

2 Answers2

5

Xampp comes packaged with PhpMyAdmin, if memory serves. Use that web interface to export your database tables in .sql format.

pma screenshot

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.

xofer
  • 3,052
  • 12
  • 19
Kenny Rasschaert
  • 8,925
  • 3
  • 41
  • 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
1

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
Michael
  • 761
  • 1
  • 6
  • 15