MySQL my.ini config file modified invalid, modify MySQL default character set

Source: Internet
Author: User

Problem starts with using MySQL command to insert Chinese data cannot be plugged in

ERROR 1366 (HY000): Incorrect string value: ' \xd6\xd0\xce\xc4 ' for column.

Start viewing questions about the character set.

If you use Set names ' GBK ';

or set character_set_database ' UTF8 '; Such a command to set the character sets, only the current settings to take effect, the next time you restart MySQL will be disabled again to reset, trouble, or not at all

At this point, I thought of modifying the default configuration file. As a start, modify the path that the configuration file My.ini to.

See if there are two services in My Computer service one is MySQL another mysql57 (the version I installed here is mysql5.7.17) Network Service

If you use net start MySQL to start the database then the service that is turned on should be MySQL

If you use net start mysql57 to start the database then the service that is opened should be mysql57

--------------------------------------------------------------------------------------------------------------- -------------------------------------------------

As for the two relationships I'm still studying, figuring out what to update ....

--------------------------------------------------------------------------------------------------------------- -------------------------------------------------

View found in the service, the default load is the My.ini under this path:

"C:/Program files/mysql/mysql Server 5.6/bin\mysqld"--defaults-file= "C:\Documents and Settings\All Users\Application Data\mysql\mysql Server 5.7\my.ini "MySQL57

and the original installation path is My-default.ini so that I mixed two, just start a meal in the My-default.ini change .... So it's not working.

So put C:\Documents and Settings\All Users\Application Data\mysql\mysql Server 5.7\my.ini "MySQL57 This path my.ini copy to c \ Program Files\mysql\mysql Server 5.7

This path can be.

At the same time, add the following content in My.ini

Add under [client]

Default-character-set=utf8

Add under [mysqld]

Character-set-server=utf8

Take care not to make the wrong call here. You can copy the past directly.

Return to command line

>net start MySQL

>mysql-uroot-p

Enter Password: ******

> Show variables like ' character_set% ';

This will find that in addition to filesystem others have been successfully changed to UTF8

This is the creation of the database to create the table insert Chinese completely no problem. There are many questions, such as in-depth understanding and then to update.

MySQL my.ini config file modified invalid, modify MySQL default character set

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