Where do mysql log files and how do I change the MySQL log file location

  • 2020-05-14 05:12:07
  • OfStack

MySQL log file believe that everyone has a lot of understanding, MySQL log file in like 1: / var log/mysqld log, teach you to modify below MySQL log file location method, for your reference.

Today I need to change the location of the MySQL log file, but I found that I couldn't change it in /etc/ my.cnf.

It was later discovered that the MySQL log bit was specified:

[root@localhost etc]# ps aux|grep mysqld
root 11830 0.5 0.0 4524 1204 pts/0 S 03:03 0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/data/mysql --socket=/var/lib/mysql/mysql.sock --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid
mysql 11890 3.7 0.1 40456 9076 pts/0 Sl 03:03 0:00 /usr/libexec/mysqld --basedir=/usr --datadir=/data/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-external-locking --port=3306 --socket=/var/lib/mysql/mysql.sock
root 11909 0.0 0.0 3908 664 pts/0 S+ 03:03 0:00 grep mysqld

chkconfig --list was found to be chkconfig on specified, day is

vim/etc/init d/mysqld learned here have been configured

get_mysql_option mysqld datadir "/var/lib/mysql"
datadir="$result"
get_mysql_option mysqld socket "$datadir/mysql.sock"
socketfile="$result"
get_mysql_option mysqld_safe log-error "/var/log/mysqld.log"
errlogfile="$result"
get_mysql_option mysqld_safe pid-file "/var/run/mysqld/mysqld.pid"
mypidfile="$result"

You should just change this

Related articles: