View mysql Character Set settings

Source: Internet
Author: User

 

1. List all character sets supported by MYSQL:

Show character set;

 

2. Current MYSQL Server Character Set

Show variables like 'character _ set _ % ';

 

3. Current MYSQL Server character set verification settings

Show variables like 'collation _ % ';

 

4. display character set settings of a Database

Name of the show create database;

 

5. display character set settings of a data table

Show create table name;

 

6. Modify the database Character Set

Alter database name default character set 'utf8 ';

 

7. Modify the character set of a data table

Alter table name default character set 'utf8 ';

 

8. Specify the character set during database creation

Create database name character set gbk collate gbk_chinese_ci;

 

9. Specify the character set during table Creation

Create table 'mysqlcode '(

'Id' TINYINT (255) unsigned not null AUTO_INCREMENT primary key,

'Content' VARCHAR (255) NOT NULL

) TYPE = myisam character set gbk COLLATE gbk_chinese_ci;

 

Library character set, the following code is missing in my. cnf:

[Client]

Default-character-set = utf8

[Mysqld]

Default-character-set = utf8

 

 

If the above Code is not added, even if the encoding specified during MYSQL compilation and installation is UTF8, the default encoding is LATIN1 during database creation. Due to the inheritance of the character set, the tables in the database are also latin1.

 

Program Access Data url parameters:

 

Jdbc: mysql: // localhost: 3306/testCharacter? AutoReconnect = true & useUnicode = yes & amp; characterEncoding = UTF8

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.