In project development, you always need to view the SQL statements executed in the background, and mysql database is no exception. Generally, you prefer to use showprocesslist, the types of SQL statements that can be analyzed and executed in the field interpretation of the output results are not suitable for general beginners. Therefore, viewing SQL statements through log files is the most direct method.
First, you must create a log file log.txt. For example, you can directly store the log file in the data directory of the mysql directory, and then add it to the mysql configuration file my. cnf.
Log =/var/log/mysql/mysqlProcess. log
In this way, all SQL statements executed by mysql can be recorded!
Log =/var/log/mysql/mysqlProcess. log
Add to [mysqld] Block
You need to manually create this file, and then chown mysql: mysql has the same permission as mysqld. log.
Recommended reading:
Create and modify MySQL view charts
MySQL view)