Find knowledge base article(s) by searching for keywords in the title e.g. type linux in the search box below
Find knowledge base article(s) by browsing the subject categories of articles
Technology quick references, cheatsheets, user manuals etc.
Shop Online through ShopifyLite
Tutorials on various IT applications.
Search Title    (UL:0 |SS:f)

Software >> Services >> RDBMS >> MySQL >> How to enable mysql error and query log

edit /etc/my.cnf

at the section on mysqld, add following line

log-error=path-to-error-log

then restart mysql

# /etc/init.d/mysql stop
# /etc/init.d/mysql start


## To enable at runtime, use SET GLOBAL statement to set the respective variable e.g. for query log

MariaDB [(none)]> SET GLOBAL general_log='ON';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> SET GLOBAL general_log_file='/var/log/mariadb/mariadb-error.log';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> show variables like 'general_log%';
+------------------+----------------------------------+
| Variable_name    | Value                            |
+------------------+----------------------------------+
| general_log      | ON                               |
| general_log_file | /var/log/mariadb/mysql-query.log |
+------------------+----------------------------------+
2 rows in set (0.00 sec)



 

[ © 2008-2021 myfaqbase.com - A property of WPDC Consulting ]