1. 修改配置文件

    sudo vim /etc/my.cnf
    
    general_log=1
    general_log_file=/var/log/mysql/mysql.log
    
  2. 创建相应文件

    mkdir -p /var/log/mysql/
    touch /var/log/mysql/mysql.log
    chmod 666 /var/log/mysql/mysql.log
    
  3. 重启mysql

    sudo systemctl restart mysqld
    
  4. 查看

    tail -F /var/log/mysql/mysql.log
    

留言

2016-09-27