Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to view and set the MySQL character set

2025-04-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

I do not know if you have any understanding of similar articles on how to view and set the MySQL character set, today I am here to give you a brief introduction. If you are interested, let's take a look at the text. I'm sure you'll get something after reading how to view and set the MySQL character set.

1. List all character sets supported by MYSQL:

SHOW CHARACTER SET

two。 Current MYSQL CVM character set settings

SHOW VARIABLES LIKE 'character_set_%'

3. Current MYSQL CVM character set verification settings

SHOW VARIABLES LIKE 'collation_%'

4. Show a database character set setting

Show create database database name

5. Show a datasheet character set setting

Show create table table name

6. Modify database character set

Alter database database name default character set 'utf8'

7. Modify datasheet character set

Alter table table name default character set 'utf8'

8. Specify the character set when building the library

Create database database name character set gbk collate gbk_chinese_ci

9. Specify the character set when creating the table

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 you don't code it, even if MYSQL compiles and installs with UTF8, the default encoding is LATIN1 when you build the library, and the tables in the library are LATIN1 because of the inheritance of the character set.

Program access data url parameters:

Jdbc:mysql://localhost:3306/testCharacter?autoReconnect=true&useUnicode=yes&characterEncoding=UTF8

After reading the article on how to view and set the MySQL character set, what do you think? If you want to know more about it, you can continue to follow our industry information section.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report