將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

注意!

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



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