mysql启动日志校验,如何启动并检查我的MySQL日志?

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.

This is what I get when I do show variables like '%log%';

mysql> show variables like '%log%';

+---------------------------------+------------------------------------+

| Variable_name | Value |

+---------------------------------+------------------------------------+

| back_log | 50 |

| binlog_cache_size | 32768 |

| binlog_format | STATEMENT |

| expire_logs_days | 0 |

| general_log | OFF |

| general_log_file | C:/xampp/mysql/data/mysql.log |

| innodb_flush_log_at_trx_commit | 1 |

| innodb_locks_unsafe_for_binlog | OFF |

| innodb_log_buffer_size | 8388608 |

| innodb_log_file_size | 5242880 |

| innodb_log_files_in_group | 2 |

| innodb_log_group_home_dir | C:\xampp\mysql\data\ |

| innodb_mirrored_log_groups | 1 |

| log | OFF |

| log_bin | OFF |

| log_bin_trust_function_creators | OFF |

| log_bin_trust_routine_creators | OFF |

| log_error | C:\xampp\mysql\data\mysql.err |

| log_output | FILE |

| log_queries_not_using_indexes | OFF |

| log_slave_updates | OFF |

| log_slow_queries | OFF |

| log_warnings | 1 |

| max_binlog_cache_size | 4294963200 |

| max_binlog_size | 1073741824 |

| max_relay_log_size | 0 |

| relay_log | |

| relay_log_index | |

| relay_log_info_file | relay-log.info |

| relay_log_purge | ON |

| relay_log_space_limit | 0 |

| slow_query_log | OFF |

| slow_query_log_file | C:/xampp/mysql/data/mysql-slow.log |

| sql_log_bin | ON |

| sql_log_off | OFF |

| sql_log_update | ON |

| sync_binlog | 0 |

+---------------------------------+------------------------------------+

37 rows in set (0.00 sec)

解决方案

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
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值