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 modify the default engine and character set in MySQL

2025-04-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article is about how to modify the default engine and character set in MySQL. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

1. Database engine 1.1 View Database engine mysql > show engines +- -+ | Engine | Support | Comment | Transactions | XA | Savepoints | +- -- + | InnoDB | DEFAULT | Supports transactions Row-level locking, and foreign keys | YES | | MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | | MEMORY | YES | Hash based, stored in memory Useful for temporary tables | NO | | BLACKHOLE | YES | / dev/null storage engine (anything you write to it disappears) | NO | | MyISAM | YES | MyISAM storage engine | NO | | CSV | | YES | CSV storage engine | NO | | ARCHIVE | YES | Archive storage engine | NO | | PERFORMANCE_SCHEMA | YES | Performance Schema | | | NO | | FEDERATED | NO | Federated MySQL storage engine | NULL | +-| -+ 9 rows in set (0.00 sec)

You can see that the default engine is InnoDB.

1.2 modify the default database engine

1. Open the configuration file

[root@VM_0_15_centos ~] # vim / etc/my.cnf

two。 Edit the following at the bottom:

Default-storage-engine=InnoDB

3. Restart the service

[root@VM_0_15_centos ~] # systemctl restart mysqld II. Database character set 2.1.View character set

View MYSQL database server and database character set

Mysql > show variables like'% character%' +-- +-- + | Variable_name | Value | +-- -+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | latin1 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | latin1 | | character_set_system | utf8 | | character_sets_dir | / usr/share/mysql/charsets/ | +-- +-- + 8 rows in set (0.01sec) character set Use character_set_client to set the character set used by the client. Character_set_connection is used to set the character set when connecting to the database. Character_set_database is used to set the default encoding format for creating the database. The encoding format of the character_set_filesystem file system converts the file name on the operating system to this character set. The default binary is the character_set_results query result character set without any conversion the default encoding format specified at the time of installation of the character_set_server server character_set_system system metadata (field name, etc.) character set character_sets_dir character set installation directory

View the character sets supported by MYSQL

Show charset

View the character set of the library

Show database status from library name like table name

View the character set of the table

Show table status from library name like table name

View the character set of all columns in the table

Show full columns from table name; 2.2 modify character set

1. Open the configuration file

[root@VM_0_15_centos ~] # vim / etc/my.cnf

two。 Edit the following at the bottom:

Character-set-server=utf8 [client] default-character-set=utf8

3. Restart the service and verify

[root@VM_0_15_centos ~] # systemctl restart MySQL [root @ VM_0_15_centos ~] # mysql-uroot-pEnter password: Welcome to the MySQL monitor. Commands end with; or\ g.Your MySQL connection id is 2Server version: 5.7.27 MySQL Community Server (GPL) Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.mysql > show variables like'% character%' +-- +-- + | Variable_name | Value | +-- -+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | Utf8 | | character_set_system | utf8 | | character_sets_dir | / usr/share/mysql/charsets/ | +-- +-- + 8 rows in set (0.00 sec) Thank you for reading! This is the end of this article on "how to modify the default engine and character set in MySQL". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

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: 249

*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

Development

Wechat

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

12
Report