MySQL Series: View and modify the encoding of the current database

Source: Internet
Author: User
Tags mysql view


MySQL, database encoding is a very important problem, sometimes we need to look at the current database encoding, and even need to modify the database encoding.
The SQL statements that view the current database encoding are:
mysql> use xxxdatabase changedmysql> show variables like ' character_set_database '; +------------------------+--- -----+| variable_name | Value |+------------------------+--------+| Character_set_database | Latin1 |+------------------------+--------+1 row in Set (0.00 sec)
Above, we first switch to the XXX database below, and then use the SQL statement: Show variables like ' character_set_database '; To view the encoding of the XXX database. The result of the query is Latin1 encoding.
Now, let's modify the code of XXX database and change it to gb2312.
mysql> ALTER DATABASE XXX CHARACTER SET gb2312; Query OK, 1 row Affected (0.00 sec)
Mysql> Show variables like ' character_set_database '; +------------------------+--------+| variable_name | Value |+------------------------+--------+| Character_set_database | gb2312 |+------------------------+--------+1 row in Set (0.00 sec)
Here are two things: 1, using SQL statements: ALTER DATABASE XXX CHARACTER SET gb2312; Set the code of XXX database in order to gb2312.2, again use show variables like ' character_set_database '; To confirm what the current xxx is encoding. After confirmation, the database encoding has been modified to gb2312.
About MySQL view and modify the current database encoding, this article introduces so much, I hope to help you, thank you!

From for notes (Wiz)

MySQL Series: View and modify the encoding of the current database

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.