2

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.

EDIT

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

8
  • Hello Abdul, silly question, but did you make sure that MySQL has rights in the other location to write and read? Commented Jan 25, 2012 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.. Commented Jan 25, 2012 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. Commented Jan 25, 2012 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 Commented Jan 25, 2012 at 6:05
  • 1
    @CraigEfrein : I have done all this but not found the log file. Commented Jan 25, 2012 at 6:09

1 Answer 1

1

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

Put it here:

[mysqld_safe]
log-error=/var/log/mysql/err.log 

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 and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.