MySQL8常用配置
[mysqld]
port = 3306
datadir = /var/lib/mysql
log_bin = /var/lib/mysql/mysql-bin
binlog_format = mixed
server-id = 1
# 设置 MySQL 默认字符集为 utf8mb4
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
# 设置并发连接数
max_user_connections = 200
# 设置临时表大小
tmp_table_size = 256M
# 设置日志缓冲区大小
innodb_log_buffer_size = 64M
# 连接和线程设置
max_connections = 200
max_connect_errors = 10
wait_timeout = 28800
interactive_timeout = 28800
max_allowed_packet = 64M
# 日志设置
log_error = /var/log/mysql/error.log
slow_query_log = 1
slow_query_log_file = /var/log/mysql/slow-query.log
long_query_time = 1
log_queries_not_using_indexes = 1
innodb_log_file_size = 64M
# 插件配置
default_authentication_plugin = mysql_native_password
# 安全配置
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
[mysql]
# 客户端设置
default-character-set = utf8mb4
[client]
# 客户端设置
port = 3306
default-character-set = utf8mb4
评论区