1

I change mysql general log from "/var/lib/mysql/general.log" to "/test/general.log",but failed.

root@iZbp1606ryhhy2d1cq7h12Z:/test# ll /
drwxr-xr-x   3 root    root     4096 Mar  9 15:23 test/

root@iZbp1606ryhhy2d1cq7h12Z:/test# ll /test/
drwxr-xr-x  2 mysql mysql 4096 Mar  9 15:23 mysql/

After mkdir "/test/mysql" and set permission. then log into mysql, with below command.

mysql -uroot -p
mysql> set GLOBAL general_log_file = '/test/mysql/gen.log';
Query OK, 0 rows affected (0.00 sec)
mysql> set GLOBAL general_log =1;
ERROR 29 (HY000): File '/test/mysql/gen.log' not found (Errcode: 13 - Permission denied)

how can I change mysql defalt path to "/test/mysql/gen.log"

explorer
  • 449
  • 2
  • 10
  • 19

1 Answers1

1

Goto /etc/mysql/my.cnf. You will get log_error and general_log flag where you can set new log path accordingly.

Ashish Tiwari
  • 1,919
  • 1
  • 14
  • 26
  • Thanks, But I can not restart mysql server, mysql version is 5.7, how to change general path without restarting. – explorer Mar 09 '17 at 08:41
  • There is query " set global general_log_file = 'log_file_path'; ". It seems it is also not working without server get restart. Just refer this http://stackoverflow.com/questions/9922894/set-global-max-allowed-packet-doesnt-work – Ashish Tiwari Mar 09 '17 at 18:25