Linux下MySQL数据库的my.cnf配置文件,解决中文乱码问题

Posted yqk150

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux下MySQL数据库的my.cnf配置文件,解决中文乱码问题相关的知识,希望对你有一定的参考价值。

系统 CentOS 7.7

mysql - 5.7.28
文件放置目录:/etc/
文件权限:644
解决问题:存储中文数据乱码

 1 # For advice on how to change settings please see
 2 # http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
 3 # *** DO NOT EDIT THIS FILE. It‘s a template which will be copied to the
 4 # *** default location during install, and will be replaced if you
 5 # *** upgrade to a newer version of MySQL.
 6 
 7 [client]
 8 default-character-set=utf8
 9 
10 [mysql]
11 #auto-rehash
12 default-character-set = utf8
13 
14 [mysqld]
15 character_set_server=utf8 
16 init_connect=‘SET NAMES utf8‘
17 
18 # Remove leading # and set to the amount of RAM for the most important data
19 # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
20 # innodb_buffer_pool_size = 128M
21 
22 # Remove leading # to turn on a very important data integrity option: logging
23 # changes to the binary log between backups.
24 # log_bin
25 
26 # These are commonly set, remove the # and set as required.
27 # basedir = .....
28 # datadir = .....
29 # port = .....
30 # server_id = .....
31 # socket = .....
32 
33 # Remove leading # to set options mainly useful for reporting servers.
34 # The server defaults are faster for transactions and fast SELECTs.
35 # Adjust sizes as needed, experiment to find the optimal values.
36 # join_buffer_size = 128M
37 # sort_buffer_size = 2M
38 # read_rnd_buffer_size = 2M 
39 
40 sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 

 

以上是关于Linux下MySQL数据库的my.cnf配置文件,解决中文乱码问题的主要内容,如果未能解决你的问题,请参考以下文章

Linux下MySQL数据库的my.cnf配置文件,解决中文乱码问题

详解MySql的配置文件my.cnf

Linux下MySQL的配置文件(my.cnf)的存放路径

MySQL配置文件my.ini或my.cnf的位置

Linux中MySQL配置文件my.cnf参数说明

linux下mysql忘记root密码解决方法