I have mysql server running successfully. The error log location is as..

mysql> show variables like '%log_erro%';
| Variable_name | Value                  |
| log_error     | /var/log/mysql/err.log |
1 row in set (0.00 sec)

The issue am facing is that when i am changing the error log location from above to some other location by changing from my.cnf and then restarting the server but the error log is not getting generated and servers starts successfully.


After restarting the server the value of the above variable get changed. but i didn't found the error log in that location.

  • Hello Abdul, silly question, but did you make sure that MySQL has rights in the other location to write and read? Jan 25 '12 at 5:55
  • @CraigEfrein : yes the folder under which the error log is to be generated have owner:group as mysql:mysql and having correct permissions also.. Jan 25 '12 at 6:00
  • @CraigEfrein : I have this problem not with all mysql servers.this is what i am facing first time i know how to change the variables from my.cnf. Jan 25 '12 at 6:03
  • Well, lets say you wanted to put the error log in /opt/log/mysql for example. 1. mkdir -p /opt/log/mysql 2. chown mysql:mysql -R /opt/log/mysql 3. Edit my.cnf and change log_error to /opt/log/mysql. Make sure that log_error is under the [mysqld] section. Then restart mysql Jan 25 '12 at 6:05
  • 1
    @CraigEfrein : I have done all this but not found the log file. Jan 25 '12 at 6:09

You may have placed the log-error option under the wrong header.

Put it here:


Then, service mysql restart

I put it there because the mysql service in /etc/init.d calls mysqld_safe to call mysqld. In addition, /etc/init.d/mysql can pass paramaters to mysqld_safe as shown above.

Just to be safe, run this also

mkdir /var/log/mysql
chown -R mysql:mysql /var/log/mysql

Give it a Try !!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.