MySQL changes the default engine and character set details

MySQL changes the default engine and character set details

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 | YES | YES |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO |
| MyISAM | YES | MyISAM storage engine | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| ARCHIVE | YES | Archive storage engine | NO | NO | NO |
| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |
| FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | 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

2. Edit the following content at the bottom:

default-storage-engine=InnoDB

3. Restart the service

[root@VM_0_15_centos ~]# systemctl restart mysqld

2. Database character set

2.1 View character set

View the 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.01 sec)


Character Set effect
character_set_client Used to set the character set used by the client.
character_set_connection Used to set the character set when connecting to the database
character_set_database Used to set the default encoding format for creating databases
character_set_filesystem The encoding format of the file system. Convert the file name on the operating system into this character set. The default binary does not perform any conversion.
character_set_results Query result character set
character_set_server The default encoding format specified when the server is installed
character_set_system System metadata (field names, etc.) character set
character_sets_dir Directory where character sets are installed

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;


Check the character set of the table

show table status from library name like table name;


Check the character set of all columns in the table

show full columns from table name;

2.2 Modify the character set

1. Open the configuration file

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

2. Edit the following content 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 mysqld
[root@VM_0_15_centos ~]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server 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 its
affiliates. Other names may be trademarks of their respective
owners.

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)

This is the end of this article about the details of modifying the default engine and character set of MySQL. For more relevant content about modifying the default engine and character set of MySQL, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Sharing of MySQL character set and database engine modification methods
  • Practical tutorial on modifying MySQL character set
  • MySQL character set viewing and modification tutorial
  • MySQL startup error 1067 and invalid recovery after changing character set and restarting
  • How to change the character set encoding to UTF8 in MySQL 5.5/5.6 under Linux
  • Comparison of storage engines supported by MySQL database
  • Implement a simple search engine based on MySQL
  • Differences and comparisons of storage engines in MySQL
  • MySQL learning summary: a preliminary understanding of the architectural design of the InnoDB storage engine

<<:  Pure CSS allows child elements to break through the width limit of parent elements

>>:  Introduction to TypeScript basic types

Recommend

What is a MySQL tablespace?

The topic I want to share with you today is: &quo...

Native JS to implement image carousel JS to implement small advertising plug-in

Recently I want to use native JS to implement som...

How to verify whether MySQL is installed successfully

After MySQL is installed, you can verify whether ...

Multiple ways to calculate age by birthday in MySQL

I didn't use MySQL very often before, and I w...

About CSS floating and canceling floating

Definition of Float Sets the element out of the n...

Quickly learn MySQL basics

Table of contents Understanding SQL Understanding...

How to adapt CSS to iPhone full screen

1. Media query method /*iPhone X adaptation*/ @me...

SQL implementation of LeetCode (182. Duplicate mailboxes)

[LeetCode] 182.Duplicate Emails Write a SQL query...

Discussion on the Issues of Image Button Submission and Form Repeated Submission

In many cases, in order to beautify the form, the ...

SQL implementation of LeetCode (196. Delete duplicate mailboxes)

[LeetCode] 196.Delete Duplicate Emails Write a SQ...

Detailed explanation of the use of MySQL concatenation function CONCAT

The previous articles introduced the replacement ...

JavaScript implements random generation of verification code and verification

This article shares the specific code of JavaScri...

Detailed explanation of Angular routing basics

Table of contents 1. Routing related objects 2. L...

Optimized implementation of count() for large MySQL tables

The following is my judgment based on the data st...