Recently, on Linux to export data with mysqldump, put on the Windows system import will appear in Chinese garbled, and then will lead to the appearance: Unknown MySQL Server host and can ' t connect to the server error.
To resolve MySQL import and export data garbled problem is the unified import and export encoding, Linux default is UTF8 encoding, and Windows is GBK encoding, so there will be the above garbled problem.
Solve MySQL import and export data garbled problem
The first thing to do is to determine the encoding format of the data you are exporting, and you need to add--default-character-set=utf8 when using mysqldump, such as the following code:
Mysqldump-uroot-p--default-character-set=utf8 dbname tablename > Bak.sql
Then you should also use--default-character-set=utf8 when importing data:
Mysql-uroot-p--default-character-set=utf8 dbname < Bak.sql
This unified coding solves the problem of the garbled data migration in MySQL.