The following articles mainly describe the correct understanding of the MySQL character set. We all know that the MySQL database can specify the actual application character set to a database, a table, and a column, the character set to use. MySQL character set is an understanding process.
(1) When compiling MySQL, a default character set is specified, which is latin1;
(2) When installing MySQL, you can specify a default character set in the configuration file (my. ini). If this character set is not specified, this value inherits from the one specified during compilation;
(3) When MySQLd is started, you can specify a default character set in the command line parameters. If not, this value inherits from the configuration in the configuration file, character_set_server is set to the default character set;
(4) When creating a new database, unless explicitly specified, the character set of this database is set to character_set_server by default;
(5) When a database is selected, character_set_database is set to the default Character Set of the database;
(6) When creating a table in the database, the default Character Set of the table is set to character_set_database, which is the default Character Set of the database;
(7) When setting a column in a table, unless explicitly specified, the default character set in this column is the default Character Set of the table;
3. MySQL Character Set Support has two aspects:
Character set and Collation)
4. Support for character sets is refined to four levels:
Server, database, table, and connection)
5. You can run the following two commands to view the character set and sorting method of the system:
- MySQL> SHOW VARIABLES LIKE 'character_set_%';
-
- +--------------------------+----------------------------+
- | Variable_name | Value |
- +--------------------------+----------------------------+
- character_set_client,utf8
- character_set_connection,utf8
- character_set_database,utf8
- character_set_filesystem,binary
- character_set_results,utf8
- character_set_server,utf8
- character_set_system,utf8
- character_sets_dir,D:\MySQL Server 5.0\share\charsets\
- MySQL> SHOW VARIABLES LIKE 'collation_%';
- +--------------------------+----------------------------+
- | Variable_name | Value |
- +--------------------------+----------------------------+
- collation_connection,utf8_general_ci
- collation_database,utf8_general_ci
- collation_server,utf8_general_ci
Status command:
- MySQL>status;
- Server characterset: utf8
- Db characterset: utf8
- Client characterset: utf8
- Conn. characterset: utf8
The above content is an introduction to the MySQL character set. I hope you will get something better.