Log mysql operations

Keywords: MySQL MariaDB Google PHP

Now I want to compare the differences before and after php web page execution, but I still can't find better software
Add, delete, and change the kind that is recorded.

Then MySQL 5 is discovered by browsing the official documentation.1 has one Common Query Log .So try:

#cd /Applications/XAMPP/xamppfiles/bin
cd /Applications/XAMPP/xamppfiles/share/mysql
./mysql.server start --log=file_name.log

Then prompt:

Starting MySQL
.2017-12-16 14:51:44 546 mysqld_safe Logging to '/Applications/XAMPP/xamppfiles/var/mysql/MacBook-Air.local.err'.
2017-12-16 14:51:44 546 mysqld_safe Starting mysqld daemon with databases from /Applications/XAMPP/xamppfiles/var/mysql
 ERROR! 

Then I think about whether it's the MySQL version or not.
Try querying MySQL version.

#Start MySQL normally first
./mysql.server start
#Enter mysql
cd /Applications/XAMPP/xamppfiles/bin
./mysql -u root

You can see the system return

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.1.26-MariaDB Source distribution

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

Wait, what is MariaDB?You can use Baidu.....

Then, to confirm whether it is MariaDB, execute

select version();

Return

MariaDB [(none)]> select version();
+-----------------+
| version()       |
+-----------------+
| 10.1.26-MariaDB |
+-----------------+
1 row in set (0.00 sec)

You can already see 10.1.26-MariaDB.

Then, all of the above is useless.The focus is here.
After a series of baidu.Don't ask me why google isn't (don't turn over walls if you can Baidu things)
Eureka MySQL configuration file my.cnf adds log parameter file error This article.
It says:

Checked google, the solution is the current log parameter is deprecated, used instead
general_log=ON
general_log_file=/tmp/mysql.log

Then execute:

#cd /Applications/XAMPP/xamppfiles/bin
cd /Applications/XAMPP/xamppfiles/share/mysql
./mysql.server start --general_log_file=file_name.log

System Return:

Starting MySQL
.2017-12-16 15:03:51 1665 mysqld_safe Logging to '/Applications/XAMPP/xamppfiles/var/mysql/MacBook-Air.local.err'.
2017-12-16 15:03:51 1665 mysqld_safe Starting mysqld daemon with databases from /Applications/XAMPP/xamppfiles/var/mysql
 SUCCESS! 

The execution was successful, but the file_name.log was not created because it was not opened.

Then execute:

#cd /Applications/XAMPP/xamppfiles/bin
cd /Applications/XAMPP/xamppfiles/share/mysql
./mysql.server stop
./mysql.server start --general_log=ON --general_log_file=file_name.log

ok, the build was successful.Where file_name.log is the path

#file_name.log

/Applications/XAMPP/xamppfiles/sbin/mysqld, Version: 10.1.26-MariaDB (Source distribution). started with:
Tcp port: 3306  Unix socket: /Applications/XAMPP/xamppfiles/var/mysql/mysql.sock
Time                 Id Command    Argument
171216 15:05:12     2 Connect   root@localhost as anonymous on 
            2 Connect   Access denied for user 'root'@'localhost' (using password: NO)
171216 15:08:44     3 Connect   root@localhost as anonymous on 
            3 Query SHOW VARIABLES
            3 Query SELECT @@global.max_allowed_packet
            3 Query USE `weiphp`
            3 Query select * from wp_user

Here you can see the log of each step

[Reference Article]
MySQL 5.1 Development Document - MySQL Log File
MySQL configuration file my.cnf adds log parameter file error
Summary of methods for viewing MySQL database versions

Posted by Goofan on Fri, 15 May 2020 09:17:40 -0700