method One: Change the my.cnf configuration file
VI/USR/LOCAL/KKMAIL/CONFIG/MYSQL/MY.CNF cancels the following two lines of comment and then restarts mysql#general_log = 1#general_log_file =/tmp/kkmail_ Mysql.log
# Set general Log Save path
# It seems that only settings can be saved to/TMP or/var folders.
Method Two: Operation in MySQL command console
# requires root user access to this file mysql> show global variables like '%general% '; +---------- --------+----------------------------------------------------+| variable_name | Value |+------------------+----------------- -----------------------------------+| general_log | off | | general_log_file | /usr/local/kkmail/data/mysql/default/localhost.log |+------------------+----------------------------------------------------+2 rows in set (0.00 sec) mysql> set global general_log_file= '/tmp/kkmail_ Mysql.log '; query ok, 0 rows affected (0.00 sec) Mysql> set global general_ Log=on; query ok, 0 rows affected (0.05 sec) mysql> show global variables like '%general% '; +------------------+----------------------+| variable_name | Value |+------------------+----------------------+| general_log | ON | | general_log_file | /tmp/kkmail_mysql.log |+------------------+----------------------+2 rows in set (0.00 sec) mysql> set global general_log=off; query ok, 0 rows affected (0.00 sec) mysql> show global variables like '%general% '; +------------------+----------------------+| variable_name | Value |+------------------+----------------------+| general_log | OFF | | general_log_file | /tmp/kkmail_mysql.log |+------------------+----------------------+2 rows in set (0.00 SEC)
Method Three: Save the log in the MySQL database general_log table
mysql> set global log_output= ' table '; query ok, 0 rows affected (0.00 sec) mysql> show global variables like '%general% '; +------------------+----------------------+| variable_name | Value |+------------------+----------------------+| general_log | OFF | | general_log_file | /tmp/kkmail_mysql.log |+------------------+----------------------+2 rows in set (0.00 sec) mysql> set global general_log=on; query ok, 0 rows affected (0.00 sec) mysql> show global variables like '%general% '; +------------------+----------------------+|&NBsp variable_name | value |+------------------+----------------------+| general_log | ON | | general_log_file | /tmp/kkmail_mysql.log |+------------------+----------------------+2 rows in set (0.01 sec) mysql> use mysqlreading table Information for completion of table and column namesyou can turn off this feature to get a quicker startup with -adatabase changedmysql> select * from general_log;
MySQL open general_log record SQL execution record