How to show the last queries executed on MySQL?

后端 未结 10 1026
感情败类
感情败类 2020-11-22 07:03

Is there any query/way to show the last queries executed on ALL servers?

10条回答
  •  半阙折子戏
    2020-11-22 07:19

    You can do the flowing thing for monitoring mysql query logs.

    Open mysql configuration file my.cnf

    sudo nano /etc/mysql/my.cnf
    

    Search following lines under a [mysqld] heading and uncomment these lines to enable log

    general_log_file        = /var/log/mysql/mysql.log
    general_log             = 1
    

    Restart your mysql server for reflect changes

    sudo service mysql start
    

    Monitor mysql server log with following command in terminal

    tail -f /var/log/mysql/mysql.log
    

提交回复
热议问题