I need to turn this on/enable it. I found some info on the net but am very confused now, I don’t know where to start.
This is what I have so far. I logged onto MySQL as root and did:
show variables like '%log%';
and got:
Variable_name | Value |
+---------------------------------+----------------------------------+
| back_log | 50 |
| binlog_cache_size | 32768 |
| binlog_format | STATEMENT |
| expire_logs_days | 10 |
| general_log | ON |
| general_log_file | /var/lib/mysql/helloise.log |
| innodb_flush_log_at_trx_commit | 1 |
| innodb_locks_unsafe_for_binlog | OFF |
| innodb_log_buffer_size | 1048576 |
| innodb_log_file_size | 5242880 |
| innodb_log_files_in_group | 2 |
| innodb_log_group_home_dir | ./ |
| innodb_mirrored_log_groups | 1 |
| log | ON |
| log_bin | OFF |
| log_bin_trust_function_creators | OFF |
| log_bin_trust_routine_creators | OFF |
| log_error | /var/log/mysql/error.log |
| 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 | 104857600 |
| 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 | /var/lib/mysql/helloise-slow.log |
| sql_log_bin | ON |
| sql_log_off | OFF |
| sql_log_update | ON |
| sync_binlog | 0
I did: SET GLOBAL general_log = 1 to set general_log = ON. Will all queries be logged in /var/lib/mysql/helloise.log?
And when I try to access the mysql directory via helloises@helloise:/var/lib$ cd mysql/ I get permission denied
and then I also have a log directory:
helloises@helloise:/var/log$
with a whole lot of log files ex: mysql.log
Which log file will contain my queries so I can track what my db is doing and see how long queries take?
Firs of all you got a permission denied because you hav not the privileges to read it. Try a
on that file and see what permission are defined. Then yuo can use chmod to change permissions. Or simply try to read that file as a root user.
The general log is a logging feature for query log, reading, from guide:
The error log:
For understand the differences i suggest you to read that site:
http://dev.mysql.com/doc/refman/5.1/en/server-logs.html
The file that contains the queries is the one in /var/lib/mysql/helloise.log
For the slow query logs you can check:
http://dev.mysql.com/doc/refman/5.1/en/slow-query-log.html
it logs all the query that take more time than long_query_time seconds (that variable must be defined by yourself). I don’t found a way to show the execution time of a query, but check that page http://dev.mysql.com/doc/refman/5.1/en/log-destinations.html it could help you on how to configure general/slowquery logging.
Hope this help.