开发者

Where can I find the MySQL log file in 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_fi开发者_Python百科les_in_group | 2                                  |
| slow_query_log_file       | C:/xampp/mysql/data/mysql-slow.log |
+---------------------------+------------------------------------+
4 rows in set (0.00 sec)


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 


It's a *.err file.

You will find it here : C:\xampp\mysql\data

To trace you error correctly, open it with Notepad++ for example and Start Mysql. You Should see the error at the end of the file.


You can also try looking at localhost/phpmyadmin/ and click on the Variables tab.


On mac, it's likely to be at:

/Applications/XAMPP/xamppfiles/var/mysql

If there are a lot of error files there, do ls -la to see which one is most recent and most likely.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜