A few days ago to build a lamp environment, want to write a small thing to move to Linux running, involving the MySQL database files migrated to Linux, directly with the FileZilla pass the past should not, I tried, anyway did not succeed. Here's how I used it:
(i) Export the database file with the mysqldump command:
Under Windows CD to the bin directory of MySQL:
C:/data.txt this directory and the exported text name can be arbitrarily taken, b after the table name, I want to export the show is called user. After entering the password, you can go to save the directory to see if there is no data files, and some words will succeed, it is possible to feel that the failure is not a CD to the bin directory of MySQL or the path is wrong and most likely error is not run with administrator privileges, will appear errcode:13- Permission denied.
(ii) Use FileZilla to upload data.txt text files to Linux:
This is simple.
(c) Open Linux, go to MySQL, move into the database:
It is recommended to look at the database encoding format before moving into the database, otherwise it will cause the Chinese in the data to become garbled
The result is that this is correct, because the default encoding format for MySQL is Latin1.
Modify the encoding format is in the ETC directory my.cnf inside the change,
Add these several places:
[Mysqld]
Character-set-server=utf8
Collation_server=utf_general_ci
init_connect= ' SET NAMES UTF8 '
[Client]
Default-character-set=utf8
Then restart the MySQL service, enter MySQL, use show variables like "%char%"; command to view the code.
Once the UTF8 encoding is confirmed, you can begin migrating the database files.
The source command is followed by the location of the FileZilla to the text file on Linux. After you finish the above steps, the database migration is complete.
</div>
MySQL database migrated from Windows to Linux