# The following options will be passed to all MySQL clients
[client]
character-set-server = utf8 #####用戶端預設串連字集集,若編譯安裝時已指定則不用填寫
port = 3306 ###用戶端串連通訊連接埠
socket = /tmp/mysql.sock #用戶端通訊的使用者密碼連接埠等資訊儲存檔案
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
port = 3306 #mysql服務端監聽連接埠
basedir = /usr/local/mysql ###Mysql軟體目錄
datadir = /usr/local/mysql/var ###mysql資料庫存放目錄
socket = /tmp/mysql.sock ##服務端通訊檔案,若丟失則重啟Mysql重建,若重啟失敗,則可能由於mysqld進程未殺死,用pkill mysql後則能重啟成功Mysql
pid-file =/usr/local/mysql/var/mysql.pid ##服務端pid進程檔案,若丟失則重啟Mysql重建,若重啟失敗,則可能由於mysqld進程未殺死,用pkill mysql後則能重啟成功Mysql
skip-external-locking ###防止外部鎖定表
skip-name-resolve ###禁止Mysqlr的DNS解析,只能通過IP串連資料庫
key_buffer_size = 384M ###僅針對Myisam表引擎緩衝最佳化
max_allowed_packet = 32M ###用戶端最大查詢表使用的記憶體
table_open_cache = 1024 ###伺服器最大緩衝表數量
sort_buffer_size = 2M ##每個串連的最大排序記憶體
join_buffer_size = 1M ##每個串連使用join查詢語句的最大記憶體
net_buffer_length = 1M
read_buffer_size = 2M
read_rnd_buffer_size = 16M
myisam_sort_buffer_size = 128M
thread_cache_size = 300
query_cache_size = 256M
query_cache_limit = 2M
thread_concurrency = 4 ##CPU*2
wait_timeout = 120 ###SQL語句最大執行時間
max_connections = 5000 ###允許資料庫最大串連數
max_connect_errors = 6000 ##允許用戶端串連資料庫出錯次數,能防止暴力破解資料庫密碼
character-set-server = utf8 ##伺服器和資料庫預設字元集
collation-server = utf8_general_ci ###用戶端校正字元集
log_slow_queries = slowquery.log ##慢查詢記錄檔
long_query_time = 3 ###慢查詢時間
myisam_recover ###mysql重啟自動修複MYisam表
replicate-ignore-db = mysql ###資料同步時不需要同步的資料庫名稱
replicate-ignore-db = information_schema
bind-address = 121.14.145.96 ##伺服器多個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
# Replication Master Server (default)
# binary logging is required for replication
log-bin=mysql-bin
# binary logging format - mixed recommended
binlog_format=mixed
# 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 omitted
server-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 high
#innodb_buffer_pool_size = 16M
#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]
quick
max_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 = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout