We often copy the MySQL data directory directly into the new environment, and normally restart MySQL to use it, but sometimes we also encounter some problems:
1, the program Access when prompted to find the table, the actual table already exists
This situation is due to the possible inconsistency of the database owner, it is recommended to manually create the database, and then copy the data directory related to the database files.
If not, please copy the Ibdata1 file from the data directory to the new data directory, which is a storage problem.
2, the program added data, modified data garbled
A, when installing MySQL, there will be a step to choose the encoding method, at this time select GBK. If not selected, the default encoding is latin1;
B, after installing and playing MySQL, manually modify its configuration file as follows:
(1) Modify the My.ini (MySQL Server Instance Configuration file) under the MySQL installation directory. Set DEFAULT-CHARACTER-SET=GBK (Note that there are 2 places)
(2) Modify the db.opt configuration file in the corresponding database directory in the data directory:
Default-character-set=gbkdefault-collation=gbk_chinese_ci
(3) Restart the database and close the console window to log back in to the database.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Character garbled problem when migrating MySQL under Windows