Home > Database > Mysql Tutorial > body text

What is the default encoding of mysql

青灯夜游
Release: 2022-06-27 17:33:24
Original
4700 people have browsed it

The default encoding in mysql is latin1 (ISO_8859_1), which can be viewed using the "SHOW VARIABLES LIKE 'character%';" command. latin1 encoding is a single-byte encoding, backward compatible with ASCII, but does not support Chinese. You can modify the default encoding by searching and setting the values ​​of the "default-character-set" and "character_set_server" items in the configuration file "my.ini" .

What is the default encoding of mysql

The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.

MySQL default character set

MySQL’s character set specification can be refined to a database, a table, and a column. What character set should be used. However, traditional programs do not use such complex configurations when creating databases and data tables. They use default configurations. So, where does the default configuration come from?

When compiling MySQL, a default character set is specified, which is latin1;

By default, the character set of mysql is latin1 (ISO_8859_1).

ISO-8859-1 encoding is a single-byte encoding and is backward compatible with ASCII. Chinese encoding is not supported. If you do not explicitly specify the encoding method when creating a database or table, the database will use the default encoding method, and then when you insert Chinese data, garbled characters will appear

How to check the default character set

Usually, you can use the following two commands to check the system character set and sorting settings:

SHOW VARIABLES LIKE 'character%';
Copy after login

What is the default encoding of mysql

SHOW VARIABLES LIKE 'collation_%';
Copy after login

What is the default encoding of mysql

#Modify the method of modifying the default character set

The default encoding of MySQL is Latin1, which does not support Chinese, so how to modify MySQL The default encoding of client] and [mysqld], add

default-character-set=utf8

, save and close (if an error occurs after adding in mysqld, you can try

character-set-server=utf8

) <div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:php;toolbar:false">default-character-set = utf8 character_set_server = utf8</pre><div class="contentsignin">Copy after login</div></div>3. Restart the MySQL service<code>[Related recommendations: mysql video tutorial

]

The above is the detailed content of What is the default encoding of mysql. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!