将mysql数据库从一台计算机复制到另一台计算机 [英] Copying mysql databases from one computer to another
问题描述
我想将我的mysql数据库从我的计算机复制到另一台计算机。
如何使用mysqldump将Mysql数据库从一台计算机复制到另一台/备份数据库
- 我们可以使用
mysqldump命令将MySQL数据库从一台PC传输到另一台PC。 -
我们必须创建数据库的转储文件,以便将数据库从
一台PC传输到另一台PC。 - 数据库不是便携式数据库,即我们不能通过复制和粘贴将
从一台电脑传输到另一台电脑。 -
我们可以使用以下方法
-
从数据库创建转储文件/备份MySQL数据库:
>打开命令提示符。 -
执行以下命令更改目录
c:press enter
p> mysqldump -u root -p database_name> database_name.sql请输入
输入密码:MySQL的密码
复制sql文件并粘贴到您要传输数据库的PC中。
2.将sql文件转储到数据库中: -
- 打开MySQL命令行客户端命令提示符。
- 执行以下命令创建数据库。
create database database_name;
请输入数据库名称必须与您的数据库名称一致。
将该sql文件复制到位置c:/ program files / MySQL / MySQL Server 5.1 / bin
打开命令提示符并执行以下命令*
> C:按Enter键
> cd程序文件/ MySQL / MySQL Server5.1 / binpress enter
> mysql -u root -p database_name< database_name.sql按回车键
您的数据库是在PC上创建的。
现在在MySQL命令提示符下检查数据库。
另一个: >
这最好的方法是使用db工具(SQLyog)
http://www.webyog.com/product/downloads
使用此工具,您可以连接2个数据库服务器,只需将服务器a上的一个数据库复制到服务器b。
有关详细信息
http://faq.webyog.com/content/12/32/en/mysql-5-objects-are-greyed-out-in-copy-dbtoto -other-host-dialogue.htmlenter image description here
另一个: b $ b
尝试这样:
mysqldump -u root -p lbry> ; dump-lbry.sql
然后导入:
mysql -u root -p < dump-lbry.sql
I want to copy my mysql database from my computer to another computer. How can I do this?
How to copy Mysql database from one Computer to another / backup database using mysqldump
- We can transfer a MySQL database from one PC to another PC using mysqldump command.
We have to create dump file of database to transfer database from one PC to another PC.
MySQL database is not portable database i.e. we cannot transfer it from one PC to another PC by copying and pasting it.
We can use following method to transfer database.
Creating a dumpfile from database/ Taking backup of MySQL database:
Open command prompt.
Execute following commands to change directory
c: "press enter"
cd program files/MySQL/MySQL Server 5.1/ bin "press enter"
mysqldump -u root -p database_name > database_name.sql "press enter"
Enter password: password of MySQL
Copy sql file and paste it in PC where you want to transfer database.
2. Dumping sql file into database:-
- Open MySQL command line client command prompt.
- Execute following command to create database.
create database database_name;
"press enter" Database name is must as that of your database_name.
Copy that sql file into location "c:/program files/MySQL/MySQL Server 5.1/bin"
*- Now open command prompt and execute following commands.*
>C: "press enter"
>cd program files/MySQL/MySQL Server5.1/bin "press enter"
>mysql –u root –p database_name < database_name.sql "press enter"
Your database is created on PC.
Now in MySQL command prompt check your database.
Another one:1
This best and the easy way is to use a db tools(SQLyog)
http://www.webyog.com/product/downloads
With this tools you can connect the 2 databases servers and just copy one database on server a to server b.
For more info
http://faq.webyog.com/content/12/32/en/mysql-5-objects-are-greyed-out-in-copy-db-to-other-host-dialogue.htmlenter image description here
Another one:2
Try something like this:
mysqldump -u root -p lbry > dump-lbry.sql
Then to import it:
mysql -u root -p < dump-lbry.sql
这篇关于将mysql数据库从一台计算机复制到另一台计算机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!