# https://blog.csdn.net/aichogn/article/details/117788275 # mysql 推荐配置 [client] socket=/var/lib/mysql/mysql.sock port=3306 [mysqld] basedir=/var/lib/mysql/ datadir=/var/lib/mysql/data socket=/var/lib/mysql/mysql.sock default-storage-engine=INNODB character_set_server=utf8mb4 collation_server=utf8mb4_general_ci port=3306 # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 server_id=1 ## 最大连接数,MySQL服务器允许的最大连接数16384,连接数越多消耗内存越多 max_connections = 1000 ## 日志过期时间,包括二进制日志(过期自动删除) # expire_logs_days = 15 ## Enable Per Table Data for InnoDB to shrink ibdata1(innoDB表优化) innodb_file_per_table = 1 #默认128M,用于存储页面缓存数据外,另外正常情况下还有大约8%的开销,主要用在每个缓存页帧的描述、adaptive hash等数据结构,适当的增加这个参数的大小,可以有效的减少 InnoDB 类型的表的磁盘 I/O innodb_buffer_pool_size = 2048M innodb_log_file_size = 512M #默认是8MB,InnoDB在写事务日志的时候,为了提高性能,也是先将信息写入Innofb Log Buffer中,当满足innodb_flush_log_trx_commit参数所设置的相应条件(或者日志缓冲区写满)之后,才会将日志写到文件 (或者同步到磁盘)中 innodb_log_buffer_size = 8M innodb_flush_log_at_trx_commit = 2 #表大小写不敏感 lower_case_table_names=1 #跳过密码 安装完后屏蔽该选项 #skip-grant-tables #关闭 binlog skip-log-bin