mysql 配置log_error

huzhichengforce發表於2015-03-02
1、我在安裝mysql 的時候是rpm包安裝的什麼都是預設今天在配置錯誤日誌的時候 按照網上找的資料 
在[mysqld]塊裡面新增如下引數
log_error=/path/error_filename.log
重啟mysql 服務 死活起不來。 
折騰了將近兩個小時 
後來加上[client]塊 立馬見效 mysql 服務啟動完成。  不明白為什麼
我的引數如下:
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
[client]
port                           = 3306
socket                         = /var/lib/mysql/mysql.sock
[mysql]
no_auto_rehash
max_allowed_packet             = 16M
prompt                         = '\u@\h [\d]> '
default_character_set          = utf8                                # Possibly this setting is correct for most recent Linux systems
[mysqldump]
max_allowed_packet             = 16M
[mysqld_safe]
open_files_limit               = 8192                                # You possibly have to adapt your O/S settings as well
user                           = mysql
log-error                      = error.log
[mysqld]


# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
# socket = .....
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 
# Connection and Thread variables
port                           = 3306
socket                         = /var/lib/mysql/mysql.sock
max_allowed_packet             = 16M
default_storage_engine         = InnoDB                              # Defaults since 5.5
# character_set_server           = utf8                                # If you prefer utf8
# collation_server               = utf8_general_ci
max_connections                = 151                                 # Values < 1000 are typically good
max_user_connections           = 50                                  # Limit one specific user/application
thread_cache_size              = 151                                 # Up to max_connections makes sense
# Query Cache
query_cache_type               = 1                                   # Set to 0 to avoid global QC Mutex
query_cache_size               = 64M                                 # Avoid too big (> 128M) QC because of QC clean-up lock!
# Session variables
sort_buffer_size               = 2M                                  # Could be too big for many small sorts
tmp_table_size                 = 32M                                 # Make sure your temporary results do NOT contain BLOB/TEXT attributes
read_buffer_size               = 128k                                # Resist to change this parameter if you do not know what you are doing
read_rnd_buffer_size           = 256k                                # Resist to change this parameter if you do not know what you are doing
join_buffer_size               = 128k                                # Resist to change this parameter if you do not know what you are doing
# Other buffers and caches
table_definition_cache         = 400                                 # As big as many tables you have
table_open_cache               = 400                                 # connections x tables/connection (~2)
# MySQL error log
log_error                      = /data/errorlog/error.log
log_warnings                   = 2
# innodb_print_all_deadlocks     = 1
# wsrep_log_conflicts            = 1                                   # for Galera only!
# Slow Query Log
slow_query_log_file            = slow.log
slow_query_log                 = 0
log_queries_not_using_indexes  = 1
long_query_time                = 0.5
min_examined_row_limit         = 100
# General Query Log
general_log_file               = general.log
general_log                    = 0
# Binary logging and Replication
server_id                      = 42
log_bin                        = mysql-bin
binlog_cache_size              = 1M

說明在配置log_error 引數的時候一定要配置[client]塊 
但不知道為什麼 ,有待研究.
[client] 是所有mysql客戶端程式讀取的配置塊。[server]是所有服務端如mysqld會讀取的配置塊。[mysqldump]則是隻有 mysqldump 才會讀取的配置檔案,[mysql] 是mysql這個客戶端程式的配置塊,而[mysqld]是mysql服務端程式mysqld 和 mysqld_safe ,mysqld_multi 的配置檔案。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26764973/viewspace-1444960/,如需轉載,請註明出處,否則將追究法律責任。