将数据库从一台机器导入/导出到另一台机器 [英] Import/Exporting databases from one machine to another

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

问题描述

我有两台电脑,一台是Ubuntu 8.10和另一台Ubuntu 9.10。在Ubuntu 8.10中,我有几个phpmyadmin中的数据库,我想将它复制到Ubuntu 9.10 phpmyadmin(没有数据库)。



我不知道我是否在正确的路径,但这是我认为我应该做的:



将数据库导出到Ubuntu 8.10。并复制这些文件(.sql)并将它们粘贴到Ubuntu 9.10 PC上的文件夹或其中。然后将这些.sql文件导入到Ubuntu 9.10中的phpmyadmin中。



有没有更好的方法来复制数据库?


$ b $

解决方案

从phpMyAdmin的主屏幕(登录后可见)有导出和导入链接。使用这些工具将数据库导出到计算机上的文件中,然后在目标主机上导入该文件。



或者,如果您具有shell访问权限机器,您可以使用命令mysqldump:

  mysqldump --password = PASSWORD -u root DATABASE> INSERT_STATEMENTS 

,然后在目标主机上创建所有数据库,其中

  mysql -u root --password = PASSWORD< INSERT_STATEMENTS 


I have two PCs, one is Ubuntu 8.10 and the other Ubuntu 9.10. On the Ubuntu 8.10, i have a few databases in phpmyadmin which i would like to copy across to the Ubuntu 9.10 phpmyadmin(which has no databases).

I'm not sure if i'm on the right path but here's what i think i should do:

Export the databases onto Ubuntu 8.10. And copy those files(.sql) and paste them onto the Ubuntu 9.10 PC in a folder or something. Then import these .sql files into phpmyadmin on Ubuntu 9.10.

Is there a better way to do Copy the databases across?

Thanks.

解决方案

From the main screen of phpMyAdmin (visible right after login) there are "Export" and "Import" links. Use these facilities to export your database (to a file on your computer) and then to import that file on the destination host.

Alternatively, if you have shell access to both machines, you could use the command mysqldump:

mysqldump --password=PASSWORD -u root DATABASE > INSERT_STATEMENTS

and then simply create all databases on the destination host with

mysql -u root --password=PASSWORD < INSERT_STATEMENTS

这篇关于将数据库从一台机器导入/导出到另一台机器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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