View MySQL Default Character Set

Source: Internet
Author: User
Tags mysql delete mysql update

I believe everyone knows about the default Character Set of MySQL. The following describes the commands for viewing the default Character Set of MySQL. It is helpful to learn about the default Character Set of MySQL.

MySQL Character Set Support has two aspects:
Character set and Collation ).
The support for character sets is refined to four layers:
Server, database, table, and connection ).
1. Default MySQL Character Set
MySQL can refine the character set designation to a database, a table, and a column.

However, traditional programs do not use such complex configurations when creating databases and data tables. They use the default configuration. So where does the default configuration come from?
(1) When compiling MySQL, a MySQL 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;
Simply put, if you do not modify anything, all the columns of all tables in all databases will be stored in latin1. However, if you install MySQL, you will generally choose multi-language support, that is, the installer automatically sets default_character_set in the configuration file as a UTF-8, which ensures that all columns of all tables in all databases are stored in UTF-8 by default.

2. view the default MySQL character set (by default, the mysql character set is latin1 (ISO_8859_1)
Generally, you can run the following two commands to view the character set and sorting method of the system:

 
 
  1. mysql> SHOW VARIABLES LIKE 'character%';   
  2. +--------------------------+---------------------------------+   
  3. | Variable_name | Value |   
  4. +--------------------------+---------------------------------+   
  5. | character_set_client | latin1 |   
  6. | character_set_connection | latin1 |   
  7. | character_set_database | latin1 |   
  8. | character_set_filesystem | binary |   
  9. | character_set_results | latin1 |   
  10. | character_set_server | latin1 |   
  11. | character_set_system | utf8 |   
  12. | character_sets_dir | D:"mysql-5.0.37"share"charsets" |   
  13. +--------------------------+---------------------------------+   
  14.  
  15. mysql> SHOW VARIABLES LIKE 'collation_%';   
  16. +----------------------+-----------------+   
  17. | Variable_name | Value |   
  18. +----------------------+-----------------+   
  19. | collation_connection | utf8_general_ci |   
  20. | collation_database | utf8_general_ci |   
  21. | collation_server | utf8_general_ci |   
  22. +----------------------+-----------------+   
  23.  

How does MySQL Delete foreign key definitions?

MySQL foreign key syntax

MySql stored procedure with Parameters

Statements used to obtain MySQL table information

How to use mysql UPDATE statements

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.