Mysql 之 参数优化了解

一、优化的配置文件

[client]
port=3306
socket=/tmp/mysql.sock

[mysqld]

# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
user = mysql
basedir = /app/mysql
datadir = /app/mysql/data
port=3307
server-id = 1
socket=/tmp/mysql.sock

#允许创建函数
log_bin_trust_function_creators = 1

character-set-server = utf8
#log-error = /var/log/mysql/error.log
#pid-file = /var/log/mysql/mysql.pid
general_log = 1
skip-name-resolve
#skip-networking
back_log = 300

max_connections = 1000
max_connect_errors = 6000
open_files_limit = 65535
table_open_cache = 4096 
max_allowed_packet = 100M
binlog_cache_size = 10M
max_heap_table_size = 32M
tmp_table_size = 64M

read_buffer_size = 8M
read_rnd_buffer_size = 8M
sort_buffer_size = 8M
join_buffer_size = 128M
key_buffer_size = 8M

thread_cache_size = 64

query_cache_type = 1
query_cache_size = 128M
query_cache_limit = 2M

ft_min_word_len = 4

log_bin = mysql-bin
binlog_format = mixed
expire_logs_days = 30

performance_schema = 0
explicit_defaults_for_timestamp

lower_case_table_names = 1

myisam_sort_buffer_size = 8M
myisam_repair_threads = 1

interactive_timeout = 28800
wait_timeout = 28800

# 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

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

# Recommended in standard MySQL setup
sql_mode=NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USER,STRICT_TRANS_TABLES

[mysqldump]
quick
max_allowed_packet = 16M

二、参数解释查看

max_connections = 1000          #客户端连接数
max_connect_errors = 6000     #错误连接数
-----
mysql> show variables like '%conn%';
+-----------------------------------------------+-----------------+
| Variable_name                                 | Value           |
+-----------------------------------------------+-----------------+
| character_set_connection                      | utf8            |
| collation_connection                          | utf8_general_ci |
| connect_timeout                               | 10              |
| disconnect_on_expired_password                | ON              |
| init_connect                                  |                 |
| max_connect_errors                            | 6000            |
| max_connections                               | 1000            |
| max_user_connections                          | 0               |
| performance_schema_session_connect_attrs_size | 0               |
+-----------------------------------------------+-----------------+
9 rows in set (0.01 sec)

猜你喜欢

转载自blog.51cto.com/12965094/2467252
今日推荐