Correct understanding of MySQL Character Set

Source: Internet
Author: User
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) A default character set is specified during MySQL compilation. This character set is latin.

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) A default character set is specified during MySQL compilation. This character set is latin.

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:

 
 
  1. MySQL> SHOW VARIABLES LIKE 'character_set_%';
  2. +--------------------------+----------------------------+
  3. | Variable_name | Value |
  4. +--------------------------+----------------------------+
  5. character_set_client,utf8
  6. character_set_connection,utf8
  7. character_set_database,utf8
  8. character_set_filesystem,binary
  9. character_set_results,utf8
  10. character_set_server,utf8
  11. character_set_system,utf8
  12. character_sets_dir,D:\MySQL Server 5.0\share\charsets\
  13. MySQL> SHOW VARIABLES LIKE 'collation_%';
  14. +--------------------------+----------------------------+
  15. | Variable_name | Value |
  16. +--------------------------+----------------------------+
  17. collation_connection,utf8_general_ci
  18. collation_database,utf8_general_ci
  19. collation_server,utf8_general_ci

Status command:

 
 
  1. MySQL>status;
  2. Server characterset: utf8
  3. Db characterset: utf8
  4. Client characterset: utf8
  5. Conn. characterset: utf8

The above content is an introduction to the MySQL character set. I hope you will get something better.

Related Article

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.