Enabling MySQL logs for version 5.6

Linode Staff

I'm having some issues where my MySQL database becomes corrupted, and I don't have any logs to help me see where and how the problem may be occurring. Any idea how I might enable some logs for this service?

1 Reply

Hey there,

You should be able to enable logging for your MySQL database by making a few different configuration changes on your Linode. The first would be to edit your my.cnf file. You should be able to open this file with a text-editor of your choice, however I'm using nano in the example below:

sudo nano /etc/my.cnf

From there, you'll just want to add the following parameters to your configuration:

 general_log = on       
 general_log_file=/var/log/mysql.general.log

Then, create your file and change it's permissions by issuing the following command:

sudo touch /var/log/mysql.general.log
sudo chown mysql.mysql /var/log/mysql.general.log

Lastly, you'll just need to restart MySQL for these changes to stick by issuing the following command:

 service mysql restart 

For more information regarding this, the link posted here may give you some more insight.

Hope that helps!

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct