mysql 内存优化 /etc/my.cnf

[mysqld]

datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock

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

symbolic-links=0

# Settings user and group are ignored when systemd is used.

# If you need to run mysqld under a different user or group,

# customize your systemd unit file for mysqld according to the

# instructions in http://fedoraproject.org/wiki/Systemd

lower_case_table_names=1

character-set-server=utf8

max_connections = 300

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

key_buffer_size = 16k

max_allowed_packet = 1M

thread_stack = 64k

sort_buffer_size = 64k

net_buffer_length = 2k

performance_schema_max_table_instances = 12500

#table_open_cache_instances = 1

#eq_range_index_dive_limit = 10

#innodb_buffer_pool_dump_at_shutdown = OFF

#innodb_buffer_pool_load_at_startup = OFF

#innodb_checksum_algorithm = innodb

innodb_file_format = Antelope

innodb_file_format_max = Antelope

innodb_large_prefix = OFF

innodb_purge_threads = 1

innodb_strict_mode = OFF

max_seeks_for_key = 4294967295

max_write_lock_count = 4294967295

myisam_max_sort_file_size = 2146435072

#performance_schema_accounts_size = 100

#performance_schema_hosts_size = 100

#performance_schema_max_cond_instances = 6900

#performance_schema_max_file_classes = 50

#performance_schema_max_mutex_instances = 21000

#performance_schema_max_rwlock_instances = 10800

#performance_schema_max_table_handles = 4000

#performance_schema_max_thread_instances = 2100

#performance_schema_setup_actors_size = 100

#performance_schema_setup_objects_size = 100

#performance_schema_users_size = 100

sync_binlog = 0

innodb_buffer_pool_size = 8M

innodb_log_buffer_size = 1M

[mysqld_safe]

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid