1cat >/etc/my.cnf<<'EOF'
2[client]
3port = 3306
4socket = /data/mysql/tmp/mysql.sock
5
6[mysql]
7prompt="\u@db \R:\m:\s [\d]> "
8no-auto-rehash
9
10[mysqld]
11user = mysql
12port = 3306
13basedir = /usr/local/mysql
14datadir = /data/mysql/data
15socket = /data/mysql/tmp/mysql.sock
16pid-file = /data/mysql/tmp/mysql.pid
17character-set-server=utf8mb4
18collation-server = utf8mb4_general_ci
19
20sql_mode='NO_UNSIGNED_SUBTRACTION,NO_ENGINE_SUBSTITUTION'
21
22open_files_limit = 65535
23innodb_open_files = 65535
24back_log=1024
25max_connections = 512
26max_connect_errors=1000000
27interactive_timeout=300
28wait_timeout=300
29max_allowed_packet = 1024M
30secure_file_priv=''
31lower_case_table_names=1
32log-error=/data/mysql/log/error.log
33
34slow_query_log=ON
35slow_query_log_file=/data/mysql/log/slow_mysql.log
36long_query_time=2
37
38innodb_flush_log_at_trx_commit=1
39innodb_log_file_size =1G
40innodb_redo_log_capacity=8388608
41innodb_log_group_home_dir=./
42
43log-bin-trust-function-creators=1
44sync_binlog = 1
45binlog_cache_size = 16M
46max_binlog_cache_size = 1G
47max_binlog_size=1G
48log-bin=mysql-bin
49relay-log=mysql-relay-bin
50binlog_format=row
51binlog_row_image=full
52server-id = 1
53authentication_policy =mysql_native_password
54
55innodb_buffer_pool_size=4G
56innodb_buffer_pool_instances=4
57EOF
58
59chmod 644 /etc/my.cnf