In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to view mysql database operation records under Linux, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
How to check the operation record of mysql database under Linux
The parameter general_log in MySQL is used to open and close the MySQL query log, and the parameter general_log_file is used to control the location of the query log. So if you want to determine whether the query log is enabled in the MySQL database, use the following command. General_log: ON means to enable query log, and OFF means to disable query log.
Mysql > show variables like'% general_log%' +-+-+ | Variable_name | Value | +-+-+ | general _ log | OFF | | general_log_file | / var/lib/mysql/DB-Server.log | +-+-- + 2 rows in set (0.00 sec)
In addition, MySQL's query log can be written to a file or a data table, which is controlled by the parameter log_output, as shown below:
Mysql > show variables like 'log_output';+-+-+ | Variable_name | Value | +-+-+ | log_output | FILE | +-+-+ 1 row in set (0.00 sec) enable MySQL query log mysql > set global general_log = on Query OK, 0 rows affected (0.11 sec) mysql > show variables like 'general_log' +-+-+ | Variable_name | Value | +-+-+ | general_log | ON | +-+-+ 1 row in set (0.02 sec) disable MySQL query log mysql > show variables like 'general_log' +-+-+ | Variable_name | Value | +-+-+ | general_log | ON | +-+-+ 1 row in set (0.01sec) mysql > set global general_log=off;Query OK, 0 rows affected (0.01sec) mysql > show variables like 'general_log' +-+-+ | Variable_name | Value | +-+-+ | general_log | OFF | +-+-+ 1 row in set (0.00 sec) set log output mode to table
If log_output=table is set, the log results are logged to a table named gengera_log, whose default engine is CSV).
Mysql > show variables like 'log_output';+-+-+ | Variable_name | Value | +-+-+ | log_output | FILE | +-+-+ 1 row in set (0.00 sec) mysql > set global log_output='table' Query OK, 0 rows affected (0.00 sec) mysql > show variables like 'log_output';+-+-+ | Variable_name | Value | +-+ | log_output | TABLE | +-+-+ 1 row in set (0.01 sec) to view query log information. Mysql > select * from mysql.general_log +- -+ | event_time | user_host | thread_id | server_id | command_type | argument | +-+-- +- -+ | 2017-07-06 12:32:05 | root [root] @ localhost [] | 1 | 1 | Query | show variables like 'general%' | | 2017-07-06 12:32:28 | root [root] @ localhost [] | 1 | 1 | Query | show variables like 'log_output' | | 2017-07-06 12:32:41 | root [root] @ localhost [] | 1 | 1 | Query | select * from MyDB.test | | 2017-07-06 12:34:36 | [root] @ localhost [] | 3 | 1 | Connect | root@localhost on | | 2017-07-06 12:34:36 | root [root] @ localhost [] | 3 | 1 | Query | KILL QUERY 1 | | 2017-07-06 12:34:36 | root [root] @ localhost [] | 3 | 1 | Quit | | 2017-07- 12:34:51 | root [root] @ localhost [] | 1 | 1 | Query | select * from mysql.general_log | +-+ -+-+ 7 rows in set (0.02 sec)
The above is all the contents of the article "how to view the operation record of mysql database under Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.