mysql5.7优化配置
概述今天主要分享一下关于mysql数据库在配置上的15条建议,仅供参考。Mysql 配置优化建议1、使用 innodb_flush_method=O_DIRECT 来避免写的时候出现双缓冲区。2、避免...
2024.11.13最近在对mysql优化,优化配置文件为/etc/my.cnf,详细配置参数如下,供参考
[client]
port = 3306
socket = /tmp/mysql.sock
[mysqld]
user = mysql
server_id = 10
port = 3306
socket = /tmp/mysql.sock
datadir = /usr/local/mysql/var
old_passwords = 1
lower_case_table_names = 1
character-set-server = utf8
default-storage-engine=MyISAM
log-bin = bin.log
log-error = error.log
pid-file = mysql.pid
long_query_time = 2
slow_query_log
slow_query_log_file = slow.log
binlog_cahe_size = 4M
binlog_format = mixed
max_binlog_size = 1G
expire_logs_days = 30
ft_min_word_len = 4
back_log = 512
max_allowed_packet = 64M
max_connections = 4096
max_connect_errors = 100
join_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 2M
sort_buffer_size = 2M
query_cache_size = 64M
table_open_cache= 10000
thread_cache_size = 256
max_heap_table_size = 64M
thread_stack = 192k
thread_concurrency = 24
local-infile = 0
skip-show-database
skip-name-resolve
skip-external-locking
connect_timeout = 600
interactive_timeout = 600
wait_timeout = 600
#** MyISAM
key_buffer_size = 512M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 64M
myisam_max_sort_file_size = 1G
myisam_repair_threads = 1
concurrent_insert = 2
myisam_recover
#*** INNODB
innodb_buffer_pool_size = 16G
innodb_additional_mem_pool_size = 32M
innodb_data_file_path = ibdata1:1G:ibdata2:1G:autoextend
innodb_read_io_threads = 8
innodb_write_io_threads = 8
innodb_file_per_table = 1
innodb_flush_log_at_trx_commit = 2
innodb_lock_wait_timeout = 120
innodb_log_buffer_size = 8M
innodb_log_file_size = 256M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_thread_concurrency = 16
innodb_open_files = 10000
#innodb_force_recovery = 4
#*** Replication Slave
read-only
#skip-slave-start
relay-log = relay.log
log-slave-updates
有什么错误,大家可以在下面留言指正
概述今天主要分享一下关于mysql数据库在配置上的15条建议,仅供参考。Mysql 配置优化建议1、使用 innodb_flush_method=O_DIRECT 来避免写的时候出现双缓冲区。2、避免...
2024.11.13一、问题说明 一个跑了3年的管理系统,年后突然有人报错说登录的时候提示无用户,于是排查发现Web端连接数据库异常,于是查数据库的服务器发现磁盘空间满了,而占用最大的就是Mysql数据库的日志目录,于...
2024.11.12mysql的慢查询sql是通过日志记录慢SQL--(俗称慢查询日志)默认的情况下,MySQL数据库不开启慢查询日志(slow query log),需要手动把它打开开启慢查询日志SET GLOBAL ...
2024.11.15MySQL 数据库可以从不同位置读取配置文件,这取决于配置、平台和构建选项。问题来了,如何才能找到MySQL数据库的配置文件位于哪里呢?以下命令将显示 mysqld 启动的实际参数,不过请确保启动 m...
2024.11.13开始之前,看完之后如果觉得本文写得好,请给我点赞转发加关注,谢谢。首先我们能明白,为什么要使用配置选项文件的原因答案很简单,因为每次启动服务器时,我们总不能每次在命令行上指定选项,这样的做法大大降低效...
2024.11.15