I use PHP to access MySQL in XAMPP. My question is where I can find the MySQL log file if there is a DB error.
Also, can I change the default location/name of that log file?
Thank you
///// Based on the coments //////
mysql> show variables like '%log_file%'; +---------------------------+------------------------------------+ | Variable_name | Value | +---------------------------+------------------------------------+ | general_log_file | C:/xampp/mysql/data/mysql.log | | innodb_log_file_size | 5242880 | | innodb_log_files_in_group | 2 | | slow_query_log_file | C:/xampp/mysql/data/mysql-slow.log | +---------------------------+------------------------------------+ 4 rows in set (0.00 sec)
The default location for each of the logs is the MySQL Data directory (C:\ProgramData\MySQL\MySQL Server [version number]\Data\), and the default log names are based on the computer's device name.
MySQL Server has several logs that can help you find out what activity is taking place. By default, no logs are enabled, except the error log on Windows. (The DDL log is always created when required, and has no user-configurable options; see Section 5.4.
MySQL log file consists of records of actions that has been performed. MySQL server generates log files that are generated based on the actions performed. The log files are of different types: – error logs, ISAM log, general query log, update log, binary log, and slow query log.
If you do
SHOW VARIABLES LIKE '%log_file%';
it will show exactly where they're being written.
The accepted answer is a bit old, for MySQL 5.1+
you may use the queries:
SET GLOBAL general_log = 'ON'; SET GLOBAL general_log_file = 'my_log.log';
First will enable loging (which may be off by default)
and the second select updates the preferred file (by default under C:/xampp/mysql/data/).
NOTE: On windows 8 you may have to run your SQL IDE as ADMINISTRATOR for this commands to get saved.
NOTE2: you can also set this in the config, go to path_to_xampp/mysql/
and edit my.ini
(copy from my-default.ini if it does not exists) and add the settings there:
[mysqld] general_log = 'ON'; general_log_file = 'my_log.log'; sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With