Best unofficial Apache Server developers community
Username
Forgot password?
Sign in with Twitter account
Sign in with Facebook account

How to see log files in mysql?

0

53 views

Good Afternoon All,
I read out that Mysql server create a log file where he keep record of all activities- like when and what query execute.
I want to see it, Can anybody tell me where it exist in my system? how can i read it? basically i need to make backup of database with different input [ backup between two dates] so i think i need to use log file here, that's why i want to go for it...
when i wondered i got that binary log file keep username and password information too[ if any query require of this] so it is very secure, not easy seen it!! i am a admin of my system , how i can see it? when i try to open var/log/mysql.log it is empty.... Thanking you in advance....

asked March 26, 2011 6:21 am CDT
posted via StackOverflow

3 Answers

1
 

You have to activate the query logging in mysql.

1.edit /etc/my.cnf

[mysqld]
log=/tmp/mysql.log

2.restart the computer or the mysqld service

service mysqld restart

3.open phpmyadmin/any application that uses mysql/mysql console and run a query

4.cat /tmp/mysql.log ( you should see the query )

answered March 30, 2011 12:00 am CDT
0
 

[client] port = 3306 socket = /var/run/mysqld/mysqld.sock

[mysqld_safe] socket = /var/run/mysqld/mysqld.sock nice = 0

[mysqld] log = /var/log/mysql/mysql.log binlog-do-db=zero

user = mysql socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr datadir = /var/lib/mysql tmpdir = /tmp skip-external-locking

bind-address = 127.0.0.1 #

* Fine Tuning

# key_buffer = 16M max_allowed_packet = 16M thread_stack = 192K thread_cache_size = 8

general_log_file = /var/log/mysql/mysql.log general_log = 1

Here you can see queries with especially long duration

log_slow_queries = /var/log/mysql/mysql-slow.log long_query_time = 2 log-queries-not-using-indexes

log-bin = /var/log/mysql/mysql.log read_only = 1 binlog-format = STATEMENT slow-query-log general-log log-slow-slave-statements log-slow-admin-statements log-error =

[mysqldump] quick quote-names max_allowed_packet = 16M

[mysql]

no-auto-rehash # faster start of mysql but no tab completition

[isamchk] key_buffer = 16M

answered March 30, 2011 12:00 am CDT
0
 

From the MySQL reference manual:

"By default, all log files are created in the data directory."

Check /var/lib/mysql

answered March 30, 2011 12:00 am CDT

Your answer

Join with account you already have


Sign in with Twitter account
Sign in with Facebook account
Sign in with Google Friend Connect

Preview
Similar questions
MySQL open files limit
February 9, 2011