/etc/my.conf

来源:互联网 发布:zookeeper源码 编辑:程序博客网 时间:2024/04/30 09:06

我的mysql配置文件

[mysqld]
default-character-set=utf8
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
wait_timeout=1814400
lower_case_table_names

# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

# Disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
# symbolic-links=0

max_allowed_packet=10M

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[client]
default-character-set=utf8


MySQL5.5以后default-character-set=utf8替换成character-set-server=utf8

 

比较专业的配置:

[client]
#default-character-set = utf8
port    = 3306
socket  = /tmp/mysql.sock

[mysql]
prompt="(/u:myprompt:)[/d]> "
no-auto-rehash

[mysqld]
default-character-set = gbk
user    = mysql
port    = 3306
socket  = /tmp/mysql.sock
basedir = /usr/local/mysql
datadir = /zz_data/mysql/
open_files_limit    = 10240
back_log = 600
max_connections = 3000
max_connect_errors = 6000
table_cache = 614
external-locking = FALSE
max_allowed_packet = 32M
sort_buffer_size = 2M
join_buffer_size = 2M
thread_cache_size = 300
thread_concurrency = 8
query_cache_size = 32M
query_cache_limit = 2M
query_cache_min_res_unit = 2k
default-storage-engine = MyISAM
default_table_type = MyISAM
thread_stack = 192K
transaction_isolation = READ-COMMITTED
tmp_table_size = 246M
max_heap_table_size = 246M
long_query_time = 2
log-slow-queries = slow_query.log
log_long_format
log-bin = bin-log
binlog_cache_size = 4M
binlog_format = MIXED
max_binlog_cache_size = 1G
max_binlog_size = 2G
expire_logs_days = 7
key_buffer_size = 256M
read_buffer_size = 1M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_max_extra_sort_file_size = 10G
myisam_repair_threads = 1
myisam_recover

skip-name-resolve
master-connect-retry = 10
slave-skip-errors = 1032,1062,126,1114,1146,1048,1396

#replicate
sync_binlog=1
relay_log = mysql-relay-bin
server-id = 10073
replicate-do-db = newdkp

innodb_additional_mem_pool_size = 16M
innodb_buffer_pool_size = 6144M
innodb_data_home_dir = /zz_data/mysql/innodb/
innodb_data_file_path = ibdata1:10G;ibdata2:10G:autoextend
innodb_file_io_threads = 4
innodb_thread_concurrency = 8
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 16M
innodb_log_file_size = 128M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
innodb_file_per_table = 0
[mysqldump]
quick
max_allowed_packet = 32M

原创粉丝点击