php 如何将我的 MySQL 数据库转移到另一台计算机?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9860118/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 07:47:56  来源:igfitidea点击:

How to transfer my MySQL database to another computer?

phpmysqlxamppdbmigrate

提问by dannail

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.

我在自己的桌面上使用 XAMPP 包,将 Window 7 作为操作系统。
这意味着我正在使用 MySQL DB 和 Apache 服务器。

现在我想将我的整个 MySQL 数据库复制/迁移到我朋友的桌面,该桌面也是 Window 作为操作系统,并且还使用 XAMPP 包。

Is there any way for me to do that?

有什么办法可以让我这样做吗?

回答by A.Aleem11

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

从 MySQL 文件夹(在旧的xampp文件夹下)复制数据库文件,除了sharebinscript文件夹见附图以查看哪些文件需要复制(只有绿色框内的文件)并在 MySQL中新安装的xampp目录中替换所有这些数据库文件文件夹。

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

重新启动 xampp 启动 MySQL 并打开数据库和表以确保其正常工作。

Files to replace in green lines

用绿线替换的文件

回答by ma c?lay

Yes. You can use the command line tool mysqldump

是的。您可以使用命令行工具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.

我假设可以通过命令行访问 mysql bin 目录。[yourusername] 和 [yourpassword] 应该不带括号。

回答by naser

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

转到此地址http://127.0.0.1/和下一个 phpmyadmin 选择数据库并单击导出并选择列...然后单击继续

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

将文件复制到服务器并转到服务器中的 phpmyadmin 并单击导入并添加文件数据库并享受它。

回答by Gilles Quenot

You can open phpmyadminin xamppand dump the DB in a file, then send it to another PC and import it in phpmyadmintoo.

您可以打开phpmyadminxampp和转储文件中的数据库,然后将其发送到另一台电脑,并导入phpmyadmin了。

回答by johnshen64

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

你的版本和datadir设置是什么?datadir 默认为 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.

您可以压缩该文件夹并将其解压缩到同一位置的新服务器(至此 mysql 服务器关闭我的两台服务器),然后在那里启动 mysql 服务器。这假设您的 datadir 设置在两台服务器中相同。

回答by Psyche

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.

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

回答by Jester

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

在 PhPmyAdmin 中,在一台计算机上进行导出和导出,然后在另一台计算机上使用导入

sql script is best option. but any work really

sql 脚本是最好的选择。但任何工作真的