[mysqld]
# 服务器标识
server-id = 1
# 端口号
port = 3306
# 字符集设置
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
# 数据库目录设置
datadir = /var/lib/mysql
# 日志文件设置
log-error = /var/log/mysql/error.log
log-bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 30
binlog_format = ROW
# 并发连接设置
max_connections = 100
max_user_connections = 50
# 查询缓存设置
query_cache_type = 1
query_cache_size = 32M
query_cache_limit = 2M
# InnoDB存储引擎设置
default_storage_engine = InnoDB
innodb_buffer_pool_size = 2G
innodb_flush_log_at_trx_commit = 2
innodb_log_file_size = 256M
innodb_flush_method = O_DIRECT
innodb_file_per_table = 1
innodb_thread_concurrency = 8
innodb_write_io_threads = 4
innodb_read_io_threads = 4
innodb_flush_neighbors = 0
# 安全设置
skip-networking
bind-address = 127.0.0.1
ssl-ca = /etc/mysql/ca.pem
ssl-cert = /etc/mysql/server-cert.pem
ssl-key = /etc/mysql/server-key.pem
# 其他设置
skip-name-resolve
lower_case_table_names = 1
原文链接:MySQL 8.0 chatgpt提供的配置,转载请注明来源!