How to modify the location of a mysql Log File

Source: Internet
Author: User

MySQL log Files are generally stored in/var/log/mysqld. log. The following describes how to modify the location of MySQL log files for your reference.

Today, you need to change the location of the MySQL Log File and find that it cannot be changed in/etc/my. cnf.

It was found that the MySQL Log bit is specified:

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

Chkconfig -- list found to be specified by chkconfig on, day is

Vim/etc/init. d/mysqld it is known that the configuration

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. pid"
Mypidfile = "$ result"

Just change it here.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.