[client] port = 3306 socket=/tmp/my3306.sock [mysql] no-auto-rehash [mysqld] #########base############ user = mysql port = 3306 bind_address = * socket=/tmp/my3306.sock character_set_server = utf8 log-error = /home/mysql/3306/logs/my3306_error.log pid-file=/home/mysql/3306/logs/my3306.pid datadir=/home/mysql/3306/data basedir=/opt/mysql default-storage-engine=InnoDB open_files_limit = 10240 autocommit = 1 sql_mode = "STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER" lower_case_table_names=1 #skip-grant-tables skip-name-resolve =on ########binlog配置#################### log-bin = /home/mysql/3306/binlog/binlog binlog_cache_size = 32M binlog_format = ROW #MIXED max_binlog_cache_size = 2048M max_binlog_size = 512M expire_logs_days = 90 server-id = 1 ####调优配置############### key_buffer_size = 1024M max_allowed_packet = 1024M table_open_cache = 1024 sort_buffer_size = 16M read_buffer_size = 16M read_rnd_buffer_size = 16M join_buffer_size = 16M myisam_sort_buffer_size = 128M thread_cache_size = 128 query_cache_size= 128M interactive_timeout = 1800 wait_timeout = 1800 ######与性能并无太大关系。为了避免一些错误我们一般都设置比较大######## max_connections = 1000 max_user_connections = 1000 max_connect_errors = 6000 back_log = 600 #####慢查询########## long_query_time=3 slow_query_log=1 slow_query_log_file=/home/mysql/3306/logs/my3306-slow-query.log ######innodb配置================ innodb_file_per_table = on innodb_buffer_pool_size = 2048M innodb_data_file_path = ibdata1:1024M:autoextend innodb_thread_concurrency = 4 innodb_flush_log_at_trx_commit = 1