MySQL basic configuration mysql default character encoding settings (My.ini set character encoding)-Reproduced

Source: Internet
Author: User
Tags mysql code

MySQL basic configuration mysql default character encoding settings (My.ini set character encoding)

MySQL default encoding is Latin1, does not support Chinese, then how to modify the default MySQL code, the following to set UTF-8 as an example to illustrate.

It is important to note that there are many places to modify, and there are a lot of ways to modify them. Here is one of the simplest and most thorough methods:

First, the Windows system
1. Abort MySQL Service
2, in the installation directory of MySQL found My.ini, if not the My-medium.ini copy as a my.ini can
3, open My.ini, in [client] and [mysqld] below all add Default-character-set=utf8, save and close (mysqld increase if error, you can try character-set-server =utf8)
4. Start the MySQL service

Second, the Linux system
1. Abort MySQL service (bin/mysqladmin-u root shutdown)
2, found in the/etc/under the MY.CNF, if not the MySQL installation directory under the Support-files directory under the MY-MEDIUM.CNF copy to/etc/and renamed to MY.CNF can
3. After opening my.cnf, add Default-character-set=utf8 under [client] and [mysqld], save and close
4. Start the MySQL service (Bin/mysqld_safe &)

Very simple, such a modification once and for all, in the future MySQL all the relevant default encoding is UTF-8, create a new table without having to set the

It is important to note that the existing data in the current database still retains the current encoding, and therefore need to self-transcoding, the method on the Internet a lot, no longer repeat

Note: If you are in a higher version of MySQL, add the

Modify the MySQL default encoding to UTF-8? Simply add at the end of the [mysqld] group name in My.ini:

Character-set-server=utf8

Can. What is the reason why the Mysqld:unknown variable ' Default-character-set=utf8 ' is wrong? Because the parameter: Default-character-set=utf8 has been removed from the newer version of MySQL. Therefore, it is recommended that the high version of MySQL use "character-set-server" instead of "Default-character-set".

View character encoding : When set up, how do you see if the character encoding we set is OK? At the command prompt, you can enter:
Show variables like ' character_set_% ';

Https://www.cnblogs.com/Jerrycjc/p/5151223.html

MySQL basic configuration mysql default character encoding settings (My.ini set character encoding)-Reproduced

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.