O'Reilly logo

MySQL 8 Cookbook by Karthik Appigatla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Selecting  query log output destinations

You can log the queries to either FILE or TABLE in MySQL itself by specifying the log_output variable, which can be either FILE or TABLE, or both FILE and TABLE.

If you specify log_output as FILE, the general query log and the slow query log will be written to the files specified by general_log_file and slow_query_log_file, respectively.

If you specify log_output as TABLE, the general query log and the slow query log will be written to the mysql.general_log and mysql.slow_log tables respectively. Log contents are accessible through SQL statements.

For example:

mysql> SET @@GLOBAL.log_output='TABLE';Query OK, 0 rows affected (0.00 sec)mysql> SET @@GLOBAL.general_log='ON';Query OK, 0 rows affected (0.02 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required