[英]mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid prevent from server restart
My mySQL server on CentOS has been working correctly, but, I am unable to restart mysqld suddenly today.我在 CentOS 上的 mySQL 服务器一直正常工作,但是,我今天突然无法重新启动 mysqld。
1) # /etc/rc.d/init.d/mysqld start 1) # /etc/rc.d/init.d/mysqld 启动
shows [failed]显示 [失败]
2) see the log 2)查看日志
tail /var/log/mysqld.log
.
.
mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
3) manually put 3)手动放置
/usr/bin/mysqld_safe
151129 15:54:36 mysqld_safe Logging to '/var/log/mysqld.log'.
151129 15:54:37 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
151129 15:54:37 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
4)check config 4)检查配置
less /etc/my.cnf
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Recommended in standard MySQL setup
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
5)check mysql directory,every owner ship is belonging to mysql. 5)查看mysql目录,每个所有者都属于mysql。 However I can't fine mysql.sock (this is set in my.cnf)但是我不能罚款 mysql.sock (这是在 my.cnf 中设置的)
cd /var/lib/mysql
ls -la
drwxr-xr-x 5 mysql mysql 4096 11月 29 15:54 2015 .
drwxr-xr-x 21 root root 4096 6月 2 06:09 2015 ..
-rw-rw---- 1 mysql mysql 56 6月 2 05:42 2015 auto.cnf
drwx------ 2 mysql mysql 4096 11月 24 11:12 2015 myapp
-rw-rw---- 1 mysql mysql 50331648 11月 29 12:30 2015 ib_logfile0
-rw-rw---- 1 mysql mysql 50331648 11月 29 12:30 2015 ib_logfile1
-rw-rw---- 1 mysql mysql 79691776 11月 29 12:30 2015 ibdata1
drwx------ 2 mysql mysql 4096 6月 2 05:42 2015 mysql
drwx------ 2 mysql mysql 4096 6月 2 05:42 2015 performance_schema
6) I found there is no mysql.sock in /var/lib/mysql directory, then I try this for test purpose. 6) 我发现 /var/lib/mysql 目录中没有 mysql.sock,然后我尝试使用它进行测试。
touch /var/lib/mysql/mysql.sock
try to restart尝试重新启动
/etc/rc.d/init.d/mysqld start
somehow mysql.sock is deleted.以某种方式删除了 mysql.sock。
Is there any other things I can try??还有什么我可以尝试的吗??
In my case the problem was that mysql tried to create temporary files in /var/run/mysqld
and that directory did not exist.就我而言,问题是 mysql 试图在/var/run/mysqld
创建临时文件,但该目录不存在。 I solved the problem by creating the directory manually and setting permissions for it:我通过手动创建目录并为其设置权限解决了这个问题:
mkdir -p /var/run/mysqld
chown mysql:mysql /var/run/mysqld
Actually, Mairadb locate pid file in /var/run/mariadb
.实际上,Mairdb 在/var/run/mariadb
找到 pid 文件。
Then,you needn't any other operation just set pid-file=/var/run/mariadb/mysqld.pid
然后,你不需要任何其他操作只需设置pid-file=/var/run/mariadb/mysqld.pid
I googled around and try.我用谷歌搜索并尝试。
restorecon -r /var/lib/mysql
it works for me.这个对我有用。 Thanks.谢谢。
Just reinstall mariadb.只需重新安装 mariadb。 This will correct all the permissions.这将更正所有权限。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.