View MySQL default character set

Source: Internet
Author: User

MySQL default character set I believe we all know something about it, let's introduce you to the MySQL default character set, and hopefully it will help you learn the MySQL default character set.

MySQL Character set support (Character set supports) has two aspects:
The character set (Character set) and the Sort method (Collation).
Support for character sets is refined to four levels:
Servers (server), database, data tables (table), and connections (connection).

1.MySQL Default Character Set
MySQL Specifies the character set that can be refined to a database, a table, a column, and what character sets should be used.
However, traditional programs do not use a complex configuration when creating databases and datasheets, and they use the default configuration, so where does the default configuration come from?
(1) When compiling MySQL, specify a MySQL default character set, this character set is latin1;
(2) When installing MySQL, you can specify a default character set in the configuration file (My.ini), and if not specified, this value is inherited from the compile-time specified;
(3) When you start MySQL, you can specify a default character set in the command line parameters, if not specified, this value inherits from the configuration in the configuration file, at this time Character_set_server is set to this default character set;
(4) When a new database is created, the character set of the database is set to Character_set_server by default unless explicitly specified;
(5) When a database is selected, Character_set_database is set to the default character set of this database;
(6) When creating a table in this 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 a column is set in the table, the default character set of the column is the set of defaults for the table unless explicitly specified;

Equivalent to a priority, 7 maximum, 1 minimum

Simply summarize, if there is no change anywhere, then all the tables of all the columns of the database are stored with latin1, but if we install MySQL, we will generally choose multi-language support, that is, the installation program will automatically in the configuration file Default_character _set is set to UTF-8, which guarantees that all the columns of all the tables in the database are stored UTF-8 by default.

2. View MySQL default character set (by default, MySQL's character set is Latin1 (iso_8859_1)
In general, the settings for viewing the character set and ordering of the system can be set through the following two commands:

Mysql>SHOW VARIABLES like 'character%'; +--------------------------+---------------------------------+   |Variable_name|Value|   +--------------------------+---------------------------------+   |Character_set_client|Latin1|   |Character_set_connection|Latin1|   |Character_set_database|Latin1|   |Character_set_filesystem| binary                          |   |Character_set_results|Latin1|   |Character_set_server|Latin1|   |Character_set_system|Utf8|   |Character_sets_dir|D: "MySQL-5.0.Panax Notoginseng"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|   +----------------------+-----------------+   

View MySQL default character set

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.