因为系统重启后 /var/run/mysqld/mysqld.pid会丢失,修改配置文件
/etc/init.d/mysqld中
get_mysql_option mysqld_safe pid-file "/var/lib/mysql/mysqld.pid",修改完成是正常启动了,但后面重启mysql就出现下面错,为什么还会去读PID file /var/run/mysqld/mysqld.pid not readable (yet?) after start.但是后台mysql也启动了,也能用,就是状态一直failed,不知道何解?
mysqld.service - SYSV: MySQL database server.
Loaded: loaded (/etc/rc.d/init.d/mysqld; bad; vendor preset: disabled)
Active: failed (Result: timeout) since 三 2021-06-09 19:07:57 CST; 18s ago
Docs: man:systemd-sysv-generator(8)
Process: 399 ExecStart=/etc/rc.d/init.d/mysqld start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/mysqld.service
├─19374 /bin/sh /usr/bin/mysqld_safe --datadir=/data01/mysql --socket=/data01/mysql/mysql.sock --pid-file=/var/lib/mysqld/mysqld.pid --basedir=/usr --user=mysql
└─19675 /usr/sbin/mysqld --basedir=/usr --datadir=/data01/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/lib/mysqld/mysqld.pid --socket=/data01/mysql/mysql.sock --port=50000
6月 09 19:02:57 rms systemd[1]: Starting SYSV: MySQL database server....
6月 09 19:02:57 rms systemd[1]: PID file /var/run/mysqld/mysqld.pid not readable (yet?) after start.
6月 09 19:02:57 rms mysqld[399]: Starting mysqld: [ 确定 ]
6月 09 19:07:57 rms systemd[1]: mysqld.service start operation timed out. Terminating.
6月 09 19:07:57 rms systemd[1]: Failed to start SYSV: MySQL database server..
6月 09 19:07:57 rms systemd[1]: Unit mysqld.service entered failed state.
6月 09 19:07:57 rms systemd[1]: mysqld.service failed.
ps:
后面改回原来的在/var/run/mysqld/目录,重启很快就启来了,这是什么原因呢???