How can I start and check my MySQL log?

前端 未结 5 1338
逝去的感伤
逝去的感伤 2020-12-13 09:45

I want to check the log in MySQL to see the queries that are being run by my application. How can I do this? I am using XAMPP and the directory to MySQL is C:\\xampp\\mysql.

相关标签:
5条回答
  • 2020-12-13 10:19

    Set up the General Query Log.

    0 讨论(0)
  • 2020-12-13 10:30

    Enable general query log by the following query in mysql command line

    SET GLOBAL general_log = 'ON';
    

    Now open C:/xampp/mysql/data/mysql.log and check query log

    If it fails, open your my.cnf file. For windows its my.ini file and enable it there. Just make sure its in the [mysqld] section

    [mysqld]
    general_log             = 1
    

    Note: In xampp my.ini file can be either found in xampp\mysql or in c:\windows directory

    0 讨论(0)
  • 2020-12-13 10:33

    Its given on OFFICIAL MYSQL website.

    SET GLOBAL general_log = 'ON';
    

    You can also use custom path:

    [mysqld]
    # Set Slow Query Log
    long_query_time = 1
    slow_query_log = 1
    slow_query_log_file = "C:/slowquery.log"
    
    #Set General Log
    log = "C:/genquery.log"
    
    0 讨论(0)
  • 2020-12-13 10:34

    For me, general_log didn't worked. But adding this to my.ini worked

    [mysqld]
    log-output=FILE
    slow_query_log = 1
    slow_query_log_file = "d:/temp/developer.log"
    
    0 讨论(0)
  • 2020-12-13 10:36

    Seems like the general query log is the file that you need. A good introduction to this is at http://dev.mysql.com/doc/refman/5.1/en/query-log.html

    0 讨论(0)
提交回复
热议问题