-
Notifications
You must be signed in to change notification settings - Fork 0
/
my.cnf
75 lines (59 loc) · 2.52 KB
/
my.cnf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
[mysqld]
# 不解析客户端主机名,这样就只能在mysql的授权表中对客户端IP授权,不能对主机名授权
skip_name_resolve = true
bind_address = 0.0.0.0
port = 3306
max_allowed_packet = 16M
explicit_defaults_for_timestamp = 1
# 1-表名等全转为小写存储,查询等也转为小写对比
lower_case_table_names = 1
#############################################################
# 设置mysql运行的各级目录
basedir = /work/mysql
datadir = /work/mysql/data
tmpdir = /work/mysql/tmp
pid_file = /work/mysql/tmp/mysqld.pid
socket = /work/mysql/tmp/mysql.sock
plugin_dir = /work/mysql/lib/plugin
#############################################################
# 数据库默认字符集,utf8mb4符集支持表情符号(表情符号占4个字节)
character_set_server = utf8mb4
collation_server = utf8mb4_unicode_ci
# 是否允许客户端设置会话的字符集,此处允许
# skip-character-set-client-handshake = off
character-set-client-handshake = on
# init_connect = 'SET NAMES utf8mb4'
#############################################################
# The locale to use for error messages. The default is en_US.
# lc_messages_dir = /work/mysql/share
lc_messages = en_US
#############################################################
# 开启系统日志
log_error = /work/mysql/log/mysqld.log
# 开启查询日志
general_log = on
general_log_file = /work/mysql/log/general.log
# 开启慢查询日志功能
# slow_query_log = on
# slow_query_log_file = /work/mysql/log/slow_query.log
# 查询超过多长时间的SQL才会记录到慢查询日志文件(默认时间为10秒)
# long_query_time = 10
# log_queries_not_using_indexes = on
#############################################################
# 用来限制LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE()传到哪个指定目录的,或者system ls /可以访问哪个目录
secure_file_priv = /
# 设置mysql服务器id,为了在使用binlog功能时区分不同的服务器
server-id = 1
# 开启binlog,并设置log_bin_index前缀为mysql-bin
log_bin = mysql-bin
# 是否信任创建存储过程的创建者,信任他们在创建存储过程时不会修改库中表的数据,否则容易导致主从复制时数据不一致,此处信任
log_bin_trust_function_creators = on
[client]
port = 3306
socket = /work/mysql/tmp/mysql.sock
default_character_set = utf8mb4
[mysql]
default-character-set = utf8mb4
socket = /work/mysql/tmp/mysql.sock
# https://gist.github.com/rhtyd/d59078be4dc88123104e
# https://fromdual.com/mysql-configuration-file-sample