将mysql数据库从一台计算机复制到另一台计算机 [英] Copying mysql databases from one computer to another

查看:835
本文介绍了将mysql数据库从一台计算机复制到另一台计算机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将我的mysql数据库从我的计算机复制到另一台计算机。

如何使用mysqldump将Mysql数据库从一台计算机复制到另一台/备份数据库

解决方案


  1. 我们可以使用
    mysqldump命令将MySQL数据库从一台PC传输到另一台PC。

  2. 我们必须创建数据库的转储文件,以便将数据库从
    一台PC传输到另一台PC。


  3. 数据库不是便携式数据库,即我们不能通过复制和粘贴将
    从一台电脑传输到另一台电脑。


  4. 我们可以使用以下方法


  5. 从数据库创建转储文件/备份MySQL数据库:

    >打开命令提示符。


  6. 执行以下命令更改目录


    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

  1. We can transfer a MySQL database from one PC to another PC using mysqldump command.
  2. We have to create dump file of database to transfer database from one PC to another PC.

  3. MySQL database is not portable database i.e. we cannot transfer it from one PC to another PC by copying and pasting it.

  4. We can use following method to transfer database.

  5. Creating a dumpfile from database/ Taking backup of MySQL database:

  6. Open command prompt.

  7. 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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆