简体   繁体   中英

How to transfer my MySQL database to another computer?

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?

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.

要以绿线替换的文件

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.

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 .

您可以从命令行使用mysqldump转储数据库,如果安装了PHPMyAdmin,则可以将其导入,然后将其导入您朋友的计算机上。

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

您可以在xampp打开phpmyadmin并将数据库转储到一个文件中,然后将其发送到另一台PC并将其导入phpmyadmin

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM