Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can I find the MySQL log file in XAMPP

Tags:

mysql

xampp

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) 
like image 815
q0987 Avatar asked Sep 03 '10 17:09

q0987


People also ask

Where can I find MySQL logs?

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.

Does MySQL have a log file?

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.

What is log file in MySQL?

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.


2 Answers

If you do

SHOW VARIABLES LIKE '%log_file%'; 

it will show exactly where they're being written.

like image 167
Marc B Avatar answered Oct 02 '22 17:10

Marc B


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  
like image 42
d.raev Avatar answered Oct 02 '22 17:10

d.raev