Character garbled during MySQL migration in Windows, mysql garbled

Source: Internet
Author: User

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.

Related Article

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: 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.