侧边栏壁纸
  • 累计撰写 61 篇文章
  • 累计创建 3 个标签
  • 累计收到 0 条评论

目 录CONTENT

文章目录

MySQL8常用配置

运维匠
2024-06-12 / 0 评论 / 0 点赞 / 32 阅读 / 2009 字
温馨提示:
本文最后更新于 2024-06-12,若内容或图片失效,请留言反馈。部分素材来自网络,若不小心影响到您的利益,请联系我们删除。

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
0

评论区