- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Turn on the general log in MySQL?
To turn ON the general log, you need to use SET command.
Following is the syntax −
set global general_log=ON;
Let us check the general log status with the help of SHOW command −
mysql> SHOW variables like '%general_log%';
This will produce the following output −
+------------------+---------------------+ | Variable_name | Value | +------------------+---------------------+ | general_log | OFF | | general_log_file | DESKTOP-QN2RB3H.log | +------------------+---------------------+ 2 rows in set (0.06 sec)
Following is the query to turn on the general log −
mysql> set global general_log=ON; Query OK, 0 rows affected (0.18 sec)
Let us check the status of general log once again −
mysql> SHOW variables like '%general_log%';
This will produce the following output −
+------------------+---------------------+ | Variable_name | Value | +------------------+---------------------+ | general_log | ON | | general_log_file | DESKTOP-QN2RB3H.log | +------------------+---------------------+ 2 rows in set (0.01 sec)
You can change the location of general_log_file −
mysql> SET GLOBAL general_log_file = 'E:\mysqllog'; Query OK, 0 rows affected (0.11 sec)
Let us check the status of general_log_file once again −
mysql> SHOW variables like '%general_log%';
This will produce the following output −
+------------------+------------+ | Variable_name | Value | +------------------+------------+ | general_log | ON | | general_log_file | E:mysqllog | +------------------+------------+ 2 rows in set (0.01 sec)
Advertisements