2012-07-23 74 views
0

我试图启用slow_query_log。我使用WinSCP从服务器下载了my.cnf文件,并添加了启用slow_query_log的代码。我的my.cnf文件有什么问题

slow_query_log = ON 
slow_query_log_file = /var/log/mysql_slow.log 

当我重新启动我的服务器我得到这个错误mysql has failed, please contact the sysadmin (result was "mysql is not running"). 在这里,我将我与slow_query_log = 1也想尽自己的my.cnf文件 。但是得到相同的错误。当我删除我添加的错误消失的代码。任何一个请帮我...

的my.cnf

[mysqld] 
datadir=/home/mysql/ 
tmpdir=/home/mysqltmp 
#max_connections = 175 #was 175 
max_connections = 80 
#max_connect_errors = 350 #was 250 
max_connect_errors = 250 
safe-show-database 
skip-locking 
key_buffer = 1024M # was 128M 
max_allowed_packet = 6M 
myisam_sort_buffer_size = 64M 

#old settings, for 900 ish max maxconn 
#sort_buffer_size = 32M 
#read_buffer_size = 32M 
#read_rnd_buffer_size = 32M 

sort_buffer_size = 5M 
read_buffer_size = 5M 
read_rnd_buffer_size = 5M 

query_cache_size= 1024M 
query_cache_limit= 16M 
max_heap_table_size = 128M 
tmp_table_size = 128M 
thread_concurrency = 16 
wait_timeout = 10 
innodb_file_per_table 
innodb_log_file_size = 10485760 
open_files_limit = 8192 
low_priority_updates = 1 
slow_query_log = ON 
slow_query_log_file = /var/log/mysql_slow.log 

# who set these? these are NOT memory settings, but rather integer settings. 
#table_cache = 1024M 
#thread_cache_size = 8M 

table_cache = 512 
thread_cache_size = 8 

[mysqldump] 
quick 
max_allowed_packet = 16M 

[mysql] 
no-auto-rehash 

[isamchk] 
key_buffer = 128M 
sort_buffer_size = 128M 
read_buffer = 2M 
write_buffer = 2M 

[myisamchk] 
key_buffer = 128M 
sort_buffer_size = 128M 
read_buffer = 2M 
write_buffer = 2M 
+0

请联系你的系统管理员,因为你的mysql问你 – zerkms 2012-07-23 11:12:53

+0

@zerkms我想知道我的代码中有任何错误,我已经添加了。如果我删除它的代码工作。 – Juice 2012-07-23 11:16:20

+0

然后删除并让它工作 – zerkms 2012-07-23 20:30:21

回答

0

创建的文件mysql_slow.log/var/log &更改文件的所有权:

chown mysql.mysql -R /var/log/mysql_slow.log 

值(1或ON)应该适用于慢速查询日志。

另外,你是否使用正则表达式?

+0

该文件的权限应该是多少?现在有权限(rw-r - r--) – Juice 2012-07-23 11:35:35

+0

的文件,我应该如何处理这个代码:“chown mysql.mysql -R/var/log/mysql_slow.log”,您可以更清楚地使用 – Juice 2012-07-23 11:36:37

+0

执行此操作命令在linux终端或konsole上更改文件夹 – Omesh 2012-07-23 13:30:15

0

支票所有权mysql.mysql和权限对文件/var/log/mysql_slow.log

ls -al /var/log/mysql_slow.log 
+0

该文件的权限应该是什么?现在具有权限'(rw-r -r-)' – Juice 2012-07-23 11:34:06

+0

的文件尝试chmod 770 -R/var/log/ – Omesh 2012-07-23 13:28:54