Character garbled problem when migrating MySQL under Windows

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.