如何查看MySQL产生的log

    xiaoxiao2023-10-10  153

    如何查看MySQL产生的log

    首先然后最后

    首先

    根据自己的数据库账号密码进入mysql

    C:\Users\Administrator>mysql -uroot -proot Warning: Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 43 Server version: 5.6.36 MySQL Community Server (GPL) Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>

    然后

    查看自己的数据库日志记录是否已经打开

    mysql> show variables where Variable_name="general_log"; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | general_log | OFF | +---------------+-------+ 1 row in set (0.17 sec)

    value是off 说明未打开,这时需要我们自行打开

    mysql> set global general_log=on; Query OK, 0 rows affected (0.25 sec)

    这时我们已经打开日志记录,下面需要查看一下日志存放路径

    最后

    mysql> show variables where Variable_name="general_log_file"; +------------------+-------------------------------------------------------+ | Variable_name | Value | +------------------+-------------------------------------------------------+ | general_log_file | D:\Mysql\mysql-5.6.36-winx64\data\PC-20180630YQUA.log | +------------------+-------------------------------------------------------+ 1 row in set (0.00 sec)

    根据路径找到log,里面就会有最近的操作情况

    MySQL, Version: 5.6.36 (MySQL Community Server (GPL)). started with: TCP Port: 3306, Named Pipe: MySQL Time Id Command Argument 190525 12:25:21 42 Query show variables where Variable_name="general_log_file" 190525 12:31:24 43 Connect root@localhost on 43 Query select @@version_comment limit 1

    希望能帮到大家。

    最新回复(0)