将mysql数据从wamp环境转移到centOS。

[英]Transfering mysql data from wamp enviroment to centOS


I have copy of .sql file that contains large data. I saved it from phpmyadmin while I was using WAMP for development. Now I am working with CentOS, and I have transferred the data to my VirtualBox running CentOs already.

我有一个包含大数据的.sql文件的副本。在使用WAMP进行开发时,我从phpmyadmin中保存了它。现在我正在使用CentOS,并且我已经将数据转移到我的VirtualBox运行CentOS。

So, the problem is not about transferring the file but running the .sql file using shell, so the data can be transferred to the new mysql server.

因此,问题不在于传输文件,而是使用shell运行.sql文件,这样数据就可以转移到新的mysql服务器上。

Does anyone know any commands?

有人知道什么命令吗?

Initially I thought moving this entire directory:

一开始我想移动整个目录:

C:\wamp\bin\mysql\mysql5.5.24\data

To my new server environment would be a good idea, but I can't seem to find where the data folder is kepyt in centos-mysql.

对于我的新服务器环境来说,这是个好主意,但是我似乎找不到在centos-mysql中数据文件夹是kepyt的地方。

whereis mysql gives mysql: /usr/bin/mysql /usr/lib/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz

mysql给mysql: /usr/bin/mysql /usr/lib/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz。

I have checked all this folders to find the data folder but to no avail.

我已经检查了所有的文件夹,找到了数据文件夹,但是没有用。

2 个解决方案

#1


1  

if you created the .sql file with mysqldump or if it is otherwise a legal mysql script containing sql commands you can simply pipe this contents to your centOs mysql instance:

如果您使用mysqldump创建了.sql文件,或者它是一个包含sql命令的合法mysql脚本,您可以简单地将该内容导入到centOs mysql实例中:

$ mysql -uroot -p dbname < dump.sql

where dbname is the name of your database and dump.sql your .sql file.

其中dbname是数据库和转储的名称。sql . sql文件。

#2


1  

Follow these steps:

遵循以下步骤:

1- In your Windows Environment, from command line(CMD), go to the folder:
   cd "C:\wamp\bin\mysql\mysql5.5.24\bin
2- Run: mysqldump -uroot -pYourPassword DataBaseName > myBackup.sql
3- On your centOs machine, open a terminal:
   mysql -uroot -p
4- In mysql console:
   create database DataBaseName;
   exit;
5- Transfer the myBackup from your Windows System, to centOS, open a terminal in 
   the same directory where myBackup.sql lives:
   mysql -uroot -p DataBaseName < myBackup.sql
智能推荐

注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.itdaan.com/blog/2014/03/31/7202c35bec42ed883445339a9fad8ba5.html



 
© 2014-2019 ITdaan.com 粤ICP备14056181号  

赞助商广告