引用《高性能MySQL》第8章

my.cnf内容:

# For advice on how to change settings please see

#

[mysqld]

# basedir = .....
# server_id = .....
 datadir = /var/lib/mysql
 port = 3306
 socket = /var/lib/mysql/mysql.sock
 pid_file = /var/lib/mysql/mysql.pid
 user = mysql
 default_storage_engine = InnoDB
 
# InnoDB
 innodb_buffer_pool_size = <value>

 innodb_log_file_size = <value>

 innodb_file_per_table = 1

 innodb_flush_nethod = 0_DIRECT
 
# MyISAM
 key_buffer_size = <value>

# log

# log_bin
 log_error = /var/lib/mysql/mysql-error.log
 slow_query_log = /var/lib/mysql/mysql-slow.log

# other

 tmp_table_size = 32M
 max_heap_table_size = 32M
 query_cache_type = 0
 query_cache_size = 0
 max_connections = <value>

 thread_cache = <value>

 table_cache = <value>

 open_files_limit = 65535

 
 [client]
 socket = /var/lib/mysql/mysql.sock
 port = 3306

 

 
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M

 

explicit_defaults_for_timestamp

#sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES