《mysql性能优化之优化配置my.cnf文件MYSQL数据库》要点:
本文介绍了mysql性能优化之优化配置my.cnf文件MYSQL数据库,希望对您有用。如果有疑问,可以联系我们。
MYSQL学习#password = your_password
port = 3306
socket = /opt/mysql/dbdata/mysql.sock
MYSQL学习# The MySQL server
[mysqld]
port = 3306
socket = /opt/mysql/dbdata/mysql.sock
skip-external-locking
key_buffer_size = 384M
max_allowed_packet = 1M
table_open_cache = 512
MYSQL学习#sort_buffer_size = 2M
sort_buffer_size = 256M
MYSQL学习#read_buffer_size = 2M
read_buffer_size = 32M
MYSQL学习#read_rnd_buffer_size = 8M
read_rnd_buffer_size = 32M
MYSQL学习myisam_sort_buffer_size = 64M
MYSQL学习thread_cache_size = 8
query_cache_size= 32M
MYSQL学习#开启慢查询日志
log_slow_admin_statements=ON
log_slow_slave_statements=ON
slow_query_log=1
MYSQL学习#慢查询日志文件存放路径
slow_query_log_file=/opt/mysql/mysqllog/logfile/slow-query.log
MYSQL学习#执行的时间大于多少秒的SQL语句记录到慢查询日志
long_query_time=2
MYSQL学习#未使用索引的查询也记录到文件
log_queries_not_using_indexes = 1
MYSQL学习#日志记录写到日志文件
log_output='FILE'
MYSQL学习
#数据连接等待时间,单位秒
interactive_timeout = 1800
wait_timeout = 1800
MYSQL学习basedir = /opt/mysql/product
datadir = /opt/mysql/dbdata
max_binlog_size=100M
log_bin=/opt/mysql/mysqllog/binlog/binlog.bin
log-error=/opt/mysql/mysqllog/logfile/mysql-err.log
MYSQL学习binlog_format=mixed
expire_logs_days=7
binlog_cache_size=4MB
MYSQL学习pid-file = /opt/mysql/dbdata/mysql.pid
default-storage-engine=MyISAM
MYSQL学习user = mysql
MYSQL学习group_concat_max_len = 10240
max_connections=3000
MYSQL学习#(cpu+磁盘)数量的2倍
#thread_concurrency = 8
thread_concurrency = 24
MYSQL学习# Point the following paths to a dedicated disk
#tmpdir = /tmp/
#skip-networking
MYSQL学习log-bin=mysql-bin
MYSQL学习server-id = 1
MYSQL学习#server-id = 2
#
# The replication master for this slave - required
#master-host = <hostname>
#
# The username the slave will use for authentication when connecting
# to the master - required
#master-user = <username>
#
# The password the slave will authenticate with when connecting to
# the master - required
#master-password = <password>
#
# The port the master is listening on.
# optional - defaults to 3306
#master-port = <port>
#
# binary logging - not required for slaves, but recommended
#log-bin=mysql-bin
#
# binary logging format - mixed recommended
binlog_format=mixed
MYSQL学习
#使用 InnoDB 引擎,可开启以下配置项
# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /opt/mysql/dbdata
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = /opt/mysql/dbdata
MYSQL学习#数据和索引缓冲区的大小
#innodb_buffer_pool_size = 256M
#innodb_buffer_pool_size = 10240M
MYSQL学习#数据字段和其他数据结构的大小
#innodb_additional_mem_pool_size = 20M
#innodb_additional_mem_pool_size = 20M
MYSQL学习# Set .._log_file_size to 25 % of buffer pool size
#redo日志大小
#innodb_log_file_size = 64M
#innodb_log_file_size = 2560M
MYSQL学习#日志缓冲区的大小
#innodb_log_buffer_size = 8M
#innodb_log_buffer_size = 16M
MYSQL学习#0 提交事物不写入日志,每秒日志文件写入和flush磁盘
#1 每秒或每次事物提交时,日志文件写入 flush磁盘
#2 每次事物提交时,日志文件写入,每秒flush磁盘
#innodb_flush_log_at_trx_commit = 1
#innodb_flush_log_at_trx_commit = 1
MYSQL学习#innodb_lock_wait_timeout = 50
MYSQL学习[mysqldump]
quick
max_allowed_packet = 16M
MYSQL学习[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
MYSQL学习[myisamchk]
#key_buffer_size = 128M
#sort_buffer_size = 128M
#read_buffer = 2M
#write_buffer = 2M
MYSQL学习key_buffer_size = 256M
sort_buffer_size = 256M
read_buffer = 32M
write_buffer = 32M
MYSQL学习[mysqlhotcopy]
interactive-timeout
MYSQL学习[mysqlhotcopy]
interactive-timeout
转载请注明本页网址:
http://www.vephp.com/jiaocheng/5579.html