So I am a bit on the fresh side of things when talking about Linux server management. I am currently trying to enable general logging for MySQL on a box I am managing that is running RHEL6. Based on everything I have read I should be able to enable both slow query logging and general query logging using the following command

/etc/rc.d/init.d/mysqld start --general_log=1 --log-output=TABLE --slow_query_log=1

This should, based on what I know, enable general logging to the mysql.general_log table (in addition to mysql.slow_log table. Unfortunately, though, when I do this and then check the global variables in MySQL I see the following.

general_log   |   OFF

I looked in to the mysqld manual and it said that I could do the following to see all of the commands / switches I could supply mysqld.

mysqld --verbose --help

So I try doing the following

/etc/rc.d/init.d/mysqld --verbose --help

And when I do that I see the following

Usage: /etc/rc.d/init.d/mysqld {start|stop|status|restart|condrestart|try-restart|reload|force-reload}

I feel like I have run in to this situation in the past where the daemon that resides in the /etc/rc.d/init.d directory is in fact not the daemon I need to be issuing commands to, but I can't seem to find any other mysqld.

My questions are the following:

  1. What am I not getting here?
  2. Is there another location specific to RHEL where daemons reside?

Thank you in advance for the help!

link|improve this question
feedback

2 Answers

up vote 1 down vote accepted

You're actually going about this the wrong way. All you need to do is edit the file /etc/my.cnf and add these directives:

#Enable general query logging
general_log=1
general_log_file=/var/log/mysqld-general.log

Then restart the MySQL daemon:

/etc/init.d/mysqld restart

And you will then have enabled the general_log

link|improve this answer
Yes I have read this in a few places but I would much prefer that it log to the general_log table than the file. Can I do this with my.cnf as well? – MoarCodePlz Dec 6 '11 at 20:13
So I put the switches I needed to throw via command line into the my.cnf file and its working! Thank you for the help. – MoarCodePlz Dec 6 '11 at 21:40
feedback

jlimon you are correct but on the /etc/my.cnf file

you have to put the configuration above mysql_safe parameters line

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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