mysql_general_log

因为bugfree要新建好多用户,所以用了存储过程。第一次写的凭自己理解,但是登录时,提示了没有产品权限。

想到了打开mysql general_log来看看具体执行的sql。

mysql> show global variables like ‘%general%‘;
+------------------+----------------------------------+
| Variable_name    | Value                            |
+------------------+----------------------------------+
| general_log      | OFF                              |
| general_log_file | /opt/lampp/var/mysql/centos1.log |
+------------------+----------------------------------+
2 rows in set (0.00 sec)

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

mysql> show global variables like ‘%general%‘;
+------------------+----------------------------------+
| Variable_name    | Value                            |
+------------------+----------------------------------+
| general_log      | ON                               |
| general_log_file | /opt/lampp/var/mysql/centos1.log |
+------------------+----------------------------------+
2 rows in set (0.03 sec)
打开对应的log文件,

[root@centos1 mysql]# cat centos1.log |grep INSERT |tail -3
           59 Query    INSERT INTO `bf_user_log` (`created_by`, `created_at`, `ip`) VALUES (1, ‘2014-12-12 01:09:45‘, ‘192.168.0.1‘)
           72 Query    INSERT INTO `bf_test_user` (`lock_version`, `authmode`, `username`, `realname`, `password`, `email`, `is_dropped`, `email_flag`, `wangwang_flag`, `wangwang`, `created_at`, `updated_at`, `created_by`, `updated_by`, `full_pinyin`, `first_pinyin`) VALUES (1, ‘internal‘, ‘b0‘, ‘b0‘, ‘e10adc3949ba59abbe56e057f20f883e‘, ‘[email protected]‘, ‘0‘, ‘1‘, ‘0‘, ‘‘, ‘2014-12-12 01:10:59‘, ‘2014-12-12 01:10:59‘, 1, 1, ‘b0‘, ‘b0‘)
           72 Query    INSERT INTO `bf_admin_action` (`action_type`, `target_table`, `target_id`, `created_at`, `created_by`) VALUES (‘Open‘, ‘test_user‘, 16, ‘2014-12-12 01:10:59‘, 1)
[root@centos1 mysql]#

执行了两个insert

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。