Home >Database >Mysql Tutorial >What is the default character encoding of mysql database
The default character encoding depends on the operating system: UNIX/Linux: utf8mb4 Windows: MySQL 8.0: utf8mb4, MySQL 5.7-: latin1
MySQL database default character encoding
The default character encoding of MySQL database depends on the operating system and installation configuration. Generally speaking, the default character encoding is as follows:
For UNIX/Linux systems:
For Windows:
utf8mb4 is a Unicode compatible character set that supports multiple languages and character sets. Latin1 is an older character set that only supports Western European languages.
Change the default character encoding
If you need to change the default character encoding, you can modify the MySQL configuration file (my.cnf
) and add the following lines :
<code>[mysqld] character-set-server=utf8mb4</code>
Next, you need to restart the MySQL service for the changes to take effect.
Impact
The default character encoding affects the character set in which data is stored and retrieved from the database. If your application and database use different character sets, this may cause data loss or display problems. Therefore, it is recommended that the application and database use the same character set to ensure data integrity and consistency.
The above is the detailed content of What is the default character encoding of mysql database. For more information, please follow other related articles on the PHP Chinese website!