How To Enable MySQL General Query Log On Linux

How To Enable MySQL General Query Log On Linux

The Server writes information to this log when client connects and disconnect. MySQL query used to find out the error in a client and want to know what exactly client sent to mysqld. This writes to log each SQL statement received from client. Let’s

You can Enable Query Log for MySQL below 5.1.29 Version, Then use the below settings in [mysqld] section.

Check Out : How To Enable Slow Query In MySQL Server In Linux 

There’re many log format for MySQL logs which can help you to find out the issues in the database or in tables.

Method 1 :

For permanent, vim /etc/my.cnf

log = /home/general-query.log

Set via MySQL Console,

SET general_log = 1;

Start the Service

systemctl restart mysqld

Check Out :  Solve MySQL Too Many Connections Error On Redhat 7

Method 2 :

You can Enable General Queries Log for MySQL above 5.1.29


general_log_file = /path/to/general-query.log

general_log = 1

Set via MySQL Console,

SET general_query_log = 1;

Check Out :  Install MySQL 5.6 Database Server Using Repository In Linux

Create a file general-query.log where you want to keep this logs.

touch general-query.log

chown -R mysql:mysql general-query.log

systemctl restart mysqld

YouTube Link :

You’re done

About Administrator


Latest Posts
Follow Us
Get the latest news delivered daily!