Home >Database >Mysql Tutorial >MySQL method to modify the default character set encoding_MySQL

MySQL method to modify the default character set encoding_MySQL

WBOY
WBOYOriginal
2016-10-09 08:33:37799browse

Today I encountered the problem of modifying the default character set encoding of MySQL. I spent a long time to solve it. I quickly recorded it so that I don’t have to worry about it every time in the future.

The command to view the MySQL character set is "show variables like '%char%';".

Take MySQL5.6 as an example, the default character set is:

At work, all character sets need to be modified to utf8.

Here’s how to modify it:

1. Open the installation directory, the default is "C:Program FilesMySQLMySQL Server 5.6",

2. Copy "my-default.ini" in the current folder and rename it to "my.ini",

3. Add "default-character-set=utf8" under both [mysqld] and [client],

4. Save the configuration file and restart MySQL.

Log in again in the command window and check again:

We see that everything has been changed to utf8.

The above is the method of changing the default character set encoding of MySQL introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support of the website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn