diff --git a/mysql/5.7/my.cnf b/mysql/5.7/my.cnf new file mode 100644 index 0000000..9303681 --- /dev/null +++ b/mysql/5.7/my.cnf @@ -0,0 +1,109 @@ +[client] +# password = your_password +port = 3306 +socket = /tmp/mysql.sock +default_character_set= utf8 + +[mysqld] +port = 3306 +socket = /tmp/mysql.sock +datadir = /var/lib/mysql +log_error = /var/log/mysql/mysqld.err + +collation_server=utf8_general_ci +init_connect='SET NAMES utf8' +character_set_server=utf8 +lower_case_table_names=1 +innodb_file_per_table=1 + +## 性能优化配置 +## 2-4G +binlog_cache_size = 64K +thread_stack = 256K +join_buffer_size = 2048K +max_heap_table_size = 384M +key_buffer_size = 256M +table_open_cache = 192 +sort_buffer_size = 768K +read_buffer_size = 768K +read_rnd_buffer_size = 512K +thread_cache_size = 96 +query_cache_size = 128M +tmp_table_size = 384M +max_connections = 500 +innodb_buffer_pool_size = 384M + +## 其他配置 +query_cache_type = 1 +default_storage_engine = InnoDB +performance_schema_max_table_instances = 400 +table_definition_cache = 400 +max_allowed_packet = 100G +net_buffer_length = 4K +myisam_sort_buffer_size = 8M +sql_mode = NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES +max_connect_errors = 100 +open_files_limit = 65535 +explicit_defaults_for_timestamp = true +skip-external-locking +skip-name-resolve +# pid_file=/var/run/mysqld.pid + +## InnoDB +innodb_data_file_path = ibdata1:10M:autoextend +innodb_log_file_size = 64M +innodb_log_buffer_size = 16M +innodb_flush_log_at_trx_commit = 1 +innodb_lock_wait_timeout = 50 +innodb_max_dirty_pages_pct = 90 +innodb_read_io_threads = 4 +innodb_write_io_threads = 4 + +## logging +general_log=ON +general_log_file=/var/log/mysql/mysqld.log +# slow_query_log=ON +# slow_query_log_file=/var/log/mysql/mysql-slow.log +# long_query_time=3 +# log_queries_not_using_indexes=ON +# log_bin=mysql-bin +# binlog_format=mixed +# server_id=1 +# expire_logs_days=10 + +## plugins +# plugin-load-add=validate_password.so +# validate_password=FORCE_PLUS_PERMANENT +# validate_password_length=8 +# validate_password_mixed_case_count=1 +# validate_password_number_count=1 +# validate_password_policy=1 + +# plugin-load-add=connection_control.so +# connection_control=FORCE_PLUS_PERMANENT +# connection_control_failed_login_attempts=FORCE_PLUS_PERMANENT +# connection_control_failed_connections_threshold=5 +# connection_control_max_connection_delay=86400 +# connection_control_min_connection_delay=1000 + +wait_timeout=1800 +interactive_timeout=1800 +# default_password_lifetime=90 + +[mysqldump] +quick +max_allowed_packet = 500M + +[mysql] +port=3306 +default_character_set=utf8 +no-auto-rehash + +[myisamchk] +key_buffer_size = 32M +sort_buffer_size = 768K +read_buffer = 2M +write_buffer = 2M + +[mysqlhotcopy] +interactive-timeout