mysql的my.cnf配置说明

来源:互联网 发布:淘宝网品牌女鞋加盟价 编辑:程序博客网 时间:2024/06/06 12:10

也不知道从哪找的,大家凑合着看吧。

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # The following options will be passed to all MySQL clients[client]#客户端默认连接字集集,若编译安装时已指定则不用填写#character-set-server = utf8  #客户端连接通信端口port = 3306    #客户端通信的用户密码端口等信息保存文件socket = /opt/mysql/tmp/mysql.sock   default-character-set=utf8# The MySQL server[mysqld]#mysql服务端监听端口port  = 3306     #mysql数据库存放目录datadir = /opt/mysql/data socket = /opt/mysql/tmp/mysql.sock       #服务端pid进程文件,若丢失则重启Mysql重新生成,若重启失败,#则可能由于mysqld进程未杀死,用pkill mysql后则能重启成功Mysqlpid-file =/opt/mysql/data/myDBserver.pid ###防止外部锁定表skip-external-locking#禁止Mysqlr的DNS解析,只能通过IP连接数据库skip-name-resolve    #仅针对Myisam表引擎缓存优化#key_buffer_size = 384M   #客户端最大查询的sql语句大小max_allowed_packet = 32M  #服务器最大缓存表数量table_open_cache = 1024 #每个连接的最大排序内存sort_buffer_size = 64M   #每个连接使用join查询语句的最大内存join_buffer_size = 16M # mysqldump时候会加快速度net_buffer_length = 1Mread_buffer_size = 2Mread_rnd_buffer_size = 16M#myisam_sort_buffer_size = 128Mthread_cache_size = 20#query_cache_size = 256M#query_cache_limit = 2M#CPU*2#thread_concurrency = 4#SQL语句最大执行时间#wait_timeout = 120  #允许数据库最大连接数max_connections = 200   #允许客户端连接数据库出错次数,能防止暴力破解数据库密码max_connect_errors = 20  #服务器和数据库默认字符集character-set-server = utf8   #客户端校正字符集collation-server = utf8_general_ci  init_connect = 'SET NAMES utf8'#忽略SQL语句大小写lower_case_table_names= 1##慢查询日志文件#log_slow_queries = slowquery.log###慢查询时间#long_query_time = 3###mysql重启自动修复MYisam表#myisam_recover  ###数据同步时不需要同步的数据库名称#replicate-ignore-db = mysql   #replicate-ignore-db = information_schema##服务器多个IP时写上比较重要#bind-address = IP地址# Don't listen on a TCP/IP port at all. This can be a security enhancement,# if all processes that need to connect to mysqld run on the same host.# All interaction with mysqld must be made via Unix sockets or named pipes.# Note that using this option without enabling named pipes on Windows# (via the "enable-named-pipe" option) will render mysqld useless!#skip-networking#每一个innodb的表都有一个独立的表空间innodb_file_per_table = 1# Replication Master Server (default)# binary logging is required for replicationlog-bin=mysql-bin# binary logging format - mixed recommendedbinlog_format=mixed# bin_log 文件保存的天数expire_logs_days = 5# 设置mysql事务级别transaction-isolation=READ-COMMITTED# required unique id between 1 and 2^32 - 1# defaults to 1 if master-host is not set# but will not function as a master if omittedserver-id = 1#Uncomment the following if you are using InnoDB tables#innodb_data_home_dir = /usr/local/mysql/var#innodb_data_file_path = ibdata1:10M:autoextend#innodb_log_group_home_dir = /usr/local/mysql/var#You can set .._buffer_pool_size up to 50 - 80 %#of RAM but beware of setting memory usage too highinnodb_buffer_pool_size = 256M#innodb_additional_mem_pool_size = 2M#Set .._log_file_size to 25 % of buffer pool size#innodb_log_file_size = 5M#innodb_log_buffer_size = 8M#innodb_flush_log_at_trx_commit = 1#innodb_lock_wait_timeout = 50[mysqldump]quickmax_allowed_packet = 32M[mysql]no-auto-rehash# Remove the next comment character if you are not familiar with SQL#safe-updates[myisamchk]key_buffer_size = 256Msort_buffer_size = 256Mread_buffer = 2Mwrite_buffer = 2M[mysqlhotcopy]interactive-timeout
原创粉丝点击