Character garbled during MySQL migration in Windows, mysql garbled
We often copy a copy of the MySQL Data DIRECTORY directly to the new environment. Normally, we can restart MySQL to use it, but sometimes we will encounter some problems:
1. when accessing the program, the system prompts that the table cannot be found. The actual table already exists.
This situation may be caused by inconsistent database owners. We recommend that you manually create a database and then copy the relevant Data files in the Data directory to the database.
If not, copy the ibdata1 file under the Data Directory to the new Data directory. This is a storage problem.
2. garbled characters occur when the program adds data and modifies data.
A. When installing mysql, select the encoding method in one step. Select gbk. If not selected, the default encoding is latin1;
B. After installing and playing with mysql, manually modify its configuration file as follows:
(1) modify my. ini (MySql Server Instance Configuration file) under the MySQL installation directory ). Set default-character-set = gbk (Note: there are 2 places)
(2) modify the db. opt configuration file under the corresponding database directory in the data directory:
Default-character-set = gbkdefault-collation = gbk_chinese_ci
(3) restart the database, close the console window, and log on to the database again.
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.