How to transfer my MySQL database to another compu

2020-02-20 05:47发布

问题:

I am using XAMPP package in my own desktop with Window 7 as OS.
That means I'm using MySQL DB and Apache server.

Now I would like to copy/migrate my whole MySQL DB to my friend's desktop, which is also with Window as OS, and also using XAMPP package.

Is there any way for me to do that?

回答1:

Copy database files from MySQL folder (under old xampp folder) except share,bin, and script folder see attached image to see which files need copy (only files with in green box) and replace all these database files in new installed xampp directory in MySQL folder.

Restart xampp start MySQL and open database and table to make sure its working.



回答2:

Yes. You can use the command line tool mysqldump

Saving your database

mysqldump -u[yourusername] -p[yourpassword] --all-databases > mydump.sql

Reading it back in:

mysql -u[yourusername] -p[yourpassword] < mydump.sql

I'm assuming the mysql bin directory is accessible via command line. [yourusername] and [yourpassword] should be written without the brackets.



回答3:

go to this address http://127.0.0.1/ and next phpmyadmin select database and click in export and select column ... and click on go

copy file to server and goto phpmyadmin in server and click on import and add file database and enjoy it .



回答4:

You can dump your database using mysqldump from the command line, or PHPMyAdmin if you have it installed and then import it on your friend's computer.



回答5:

In PhPmyAdmin go to Export and export on one computer and then use import on another

sql script is best option. but any work really



回答6:

You can open phpmyadmin in xampp and dump the DB in a file, then send it to another PC and import it in phpmyadmin too.



回答7:

what is your version and datadir setting? the datadir defaults to something like C:\Program Files\MySQL\MySQL Server 5.0\data

you can just zip up that folder and unzip it in the new server (wich mysql server shut down i both servers) in the same place, and start mysql server there. This assumings that your datadir setting is the same in both servers.