Linux – How to find out where or if MYSQL5 logs are stored on a machine WHM/Cpanel

linuxlog-filesMySQLpathssql server

  • I have a WHM/Cpanel re-seller hosting account on a virtual private server (Linux).
  • I have root access to the machine via SSH

I am trying to locate a file that contains information that will help me to determine which users have accessed what db and from which hosts.

I would imagine this kind of data is stored in a log file somewhere.

The MySQL page says:

The general query log - Established client connections and statements received from clients

See: http://dev.mysql.com/doc/refman/5.0/en/server-logs.html

It also says:

By default, all log files are created in the mysqld data directory. 

So, I am am NOT asking where are the general query log logs stored, (cos I expect I will get answers saying "it depends")

Please help me work out:

"How can go about finding out where MySQL general query log logs are stored on a linux machine"

Couple of things i've already tried:

I looked at

 /etc/my.cnf

it was a tiny file that only contained the following info:

[mysqld]
skip-bdb
skip-innodb
set-variable = max_connections=500
safe-show-database
~
~

I have looked in:

/var/lib/mysql/

But I could not see any log-like file names in that directory.

Any clues on this would be most welcome.

Best Answer

To ask MySQL where it is storing the general logs (and whether they are on or not), you can simply type:

 show variables like 'general_log%';

Into a MySQL command prompt (or run the query from phpmyadmin).

e.g.

mysql> show variables like 'general_log%';
+------------------+----------------------------+
| Variable_name    | Value                      |
+------------------+----------------------------+
| general_log      | OFF                        |
| general_log_file | /var/run/mysqld/mysqld.log |
+------------------+----------------------------+

I think that's what you're asking for.