• 基于Ubuntu20.04.01
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
vim /etc/mysql/mariadb.conf.d/50-client.cnf
#(MySQL为该路径:/etc/my.cnf.d/client.cnf) 文件,添加如下内容

[client]

default-character-set=utf8

vim /etc/mysql/mariadb.conf.d/50-mysql-clients.cnf
#(MySQL为该路径:/etc/my.cnf.d/mysql-clients.cnf)文件,添加如下内容

[mysql]
default-character-set=utf8

vim /etc/mysql/mariadb.cnf
#(MySQL为该路径:/etc/my.cnf) 文件,添加如下内容

[mysqld]
character-set-server=utf8
default-storage-engine=INNODB

•重启服务

# systemctl restart mariadb