快被急疯了, MySQL 启动不了,始终显示“The server quit without updating PID file”

2016-08-10 06:29:45 +08:00
 Reign
昨晚睡了两个小时的觉,捣鼓了一晚上都不行,始终启动不了 MySQL

系统是 centos6.5 安装的 AMH4.2 ,昨天下午网站始终打不开,于是我想重启 MySQL ,用 amh 自带的命令: amh mysql 然后选择 restart ,但是,那个 MySQL 一直关不了,等了好久都关不了,我一时心急,做出了一个错误的决定,关机重启,重启之后, amh 的 nginx 和 php 能正常启动,就是 MySQL 一直启动不了,我用 amh mysql 命令,选择了 start ,始终显示这个错误信息:

[AMH] MySQL Management please select: (1~6)
1) start 3) restart 5) force-reload
2) stop 4) reload 6) exit

Starting MySQL.The server quit without updating PID file (/[FAILED]l/mysql/data/ns471333.eu.pid).
把网上的做饭全部试玩了都不行,比如这个帖子里面的: http://stackoverflow.com/questions/4963171/mysql-server-startup-error-the-server-quit-without-updating-pid-file

求 MySQL 高手解疑一下吧,谢谢,谢谢
-------------------------------------------------------------------------------------------------------------------------------
这是error.log信息:
160810 00:15:00 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
160810 0:15:00 [Note] Plugin 'InnoDB' is disabled.
22:15:00 UTC - mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.

key_buffer_size=16777216
read_buffer_size=262144
max_used_connections=0
max_threads=151
thread_count=0
connection_count=0
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 133467 K bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0 thread_stack 0x30000
/usr/local/mysql/bin/mysqld(my_print_stacktrace+0x33)[0x838bdb3]
/usr/local/mysql/bin/mysqld(handle_fatal_signal+0x432)[0x8280302]
[0xa0af2400]
/usr/local/mysql/bin/mysqld(wait_for_free_space+0x5c)[0x837368c]
/usr/local/mysql/bin/mysqld(my_write+0x102)[0x838a602]
/usr/local/mysql/bin/mysqld(my_b_flush_io_cache+0x43a)[0x8376dfa]
/usr/local/mysql/bin/mysqld(_ZN13MYSQL_BIN_LOG21sync_purge_index_fileEv+0x20)[0x82fcc10]
/usr/local/mysql/bin/mysqld(_ZN13MYSQL_BIN_LOG4openEPKc13enum_log_typeS1_10cache_typebmbb+0xc9)[0x83027a9]
/usr/local/mysql/bin/mysqld[0x812a116]
/usr/local/mysql/bin/mysqld(_Z11mysqld_mainiPPc+0x3a1)[0x812c9d1]
/usr/local/mysql/bin/mysqld(main+0x1b)[0x8123edb]
/lib/libc.so.6(__libc_start_main+0xe6)[0xa07c7d26]
/usr/local/mysql/bin/mysqld[0x8123e21]
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
160810 00:15:00 mysqld_safe mysqld from pid file /usr/local/mysql/data/ns471333.eu.pid ended
160810 00:21:36 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
160810 0:21:36 [Note] Plugin 'InnoDB' is disabled.
22:21:36 UTC - mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.

key_buffer_size=16777216
read_buffer_size=262144
max_used_connections=0
max_threads=151
thread_count=0
connection_count=0
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 133467 K bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
Thread pointer: 0x0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0 thread_stack 0x30000
/usr/local/mysql/bin/mysqld(my_print_stacktrace+0x33)[0x838bdb3]
/usr/local/mysql/bin/mysqld(handle_fatal_signal+0x432)[0x8280302]
[0xa52d9400]
/usr/local/mysql/bin/mysqld(wait_for_free_space+0x5c)[0x837368c]
/usr/local/mysql/bin/mysqld(my_write+0x102)[0x838a602]
/usr/local/mysql/bin/mysqld(my_b_flush_io_cache+0x43a)[0x8376dfa]
/usr/local/mysql/bin/mysqld(_ZN13MYSQL_BIN_LOG21sync_purge_index_fileEv+0x20)[0x82fcc10]
/usr/local/mysql/bin/mysqld(_ZN13MYSQL_BIN_LOG4openEPKc13enum_log_typeS1_10cache_typebmbb+0xc9)[0x83027a9]
/usr/local/mysql/bin/mysqld[0x812a116]
/usr/local/mysql/bin/mysqld(_Z11mysqld_mainiPPc+0x3a1)[0x812c9d1]
/usr/local/mysql/bin/mysqld(main+0x1b)[0x8123edb]
/lib/libc.so.6(__libc_start_main+0xe6)[0xa4faed26]
/usr/local/mysql/bin/mysqld[0x8123e21]
The manual page at http://dev.mysql.com/do160810 00:21:36 mysqld_safe mysqld from pid file /usr/local/mysql/data/ns471333.eu.pid ended
19871 次点击
所在节点    程序员
42 条回复
Neveroldmilk
2016-08-10 09:01:56 +08:00
估计是没改对 mysql 的 my.cnf 。 mysql 的版本以及 Linux 发行版不同,配置文件的路径大不相同。
notolddriver
2016-08-10 09:06:17 +08:00
首先使用 ps -ef |grep mysqld 查看下 pid
然后 kill -9 pid
再重启 mysql 试下 一般会正常


不行的话:

源码包解压出来的目录下 support-files/目录下 拷贝 my.cnf 的 模板文件


我拷贝的这个
cp ./support-files/my-innodb-heavy-4G.cnf /etc/mysql/my.cnf


记得一定在重启前 杀掉 mysql 的进程

配置的 my.cnf 文件有问题
Reign
2016-08-10 09:18:45 +08:00
@xi_lin
@Neveroldmilk

# locate my.cnf
/etc/my.cnf
/usr/local/mysql/mysql-test/include/default_my.cnf
/usr/local/mysql/mysql-test/suite/federated/my.cnf
/usr/local/mysql/mysql-test/suite/rpl/my.cnf
只有第一个了
yanyandenuonuo
2016-08-10 09:23:22 +08:00
内存爆了吧。。试试加内存或者 swap
Reign
2016-08-10 09:27:20 +08:00
@yanyandenuonuo 话说 我的内存消耗咋这么大,什么程序都没运行啊
total used free shared buffers cached
Mem: 4020 2514 1506 0 478 1774
-/+ buffers/cache: 262 3758
Swap: 510 0 510
SharkIng
2016-08-10 09:29:21 +08:00
删了 my.cnf????? 什么鬼点子?

我遇到过一个类似的问题,(忘记 Error Message 是什么了)你注意一下,你的 my.cnf 是 MySQL 的配置文件,你删了肯定不能用了啊.....

你要是安装的那种一键安装或者集成的 LN(A)MP 之类的东西,一般的文件是安装在 /usr/local/里面的,你的 MySQL 配置文件应该是在 /etc/mysql/my.cnf 之类的地方。如果你系统 Somehow 又安装了一遍 MySQL ,那么有可能你的配置文件默认到了 /etc/my.cnf 上,你确认下你是不是有两个 my.cnf

我当时遇到的问题是无法启动,研究半天发现是 my.cnf 的配置上的一些内容不一样,例如数据库的位置等等,解决办法你把两个弄成一样的就行了(除非你想去研究哪个是正确的配置问题)
Reign
2016-08-10 09:30:59 +08:00
@yanyandenuonuo 清理掉内存启动 mysql 还是抛出一样错误
Reign
2016-08-10 09:32:41 +08:00
@SharkIng 只有一个 /etc/my.cnf
whisperer
2016-08-10 09:39:09 +08:00
我以前遇到过这个错误,你参考下(当时我用的是 wdlinux ):

修改 /www/wdlinux/init.d/mysqld

```
basedir=
datadir=
```

修改为
```
basedir=/www/wdlinux/mysql
datadir=/www/wdlinux/mysql/var
```
Reign
2016-08-10 09:49:26 +08:00
@whisperer 把这些都加进去了还是抛出一样的错误
ETiV
2016-08-10 10:15:17 +08:00
22:21:36 UTC - mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured.

回复里没法加粗...

这个出现了两次,说明相同的错误导致崩溃,然后 mysqld 尝试了一次自动重启,但还是没有起来。

这里说的已经很清楚了,要么是 bug ,要么是你的二进制文件、依赖库有问题导致的。

你换一个安装方式吧,找个 yum 官方源镜像什么的重新装 mysql 。

别围绕“ pid 文件”搞,方向不对的。
gaocheng
2016-08-10 10:19:28 +08:00
sudo su mysql 之后再启动试试
defunct9
2016-08-10 10:22:59 +08:00
交出权限, ssh 上去帮你搞好
xi2008wang
2016-08-10 10:32:41 +08:00
重装 mysql 吧,很大可能强制系统重启时 mysql 文件损坏了。

如果只是 mysql 损坏还好,重装就好了,如果数据也损坏就杯具了。
Troevil
2016-08-10 10:35:54 +08:00
我也遇到过, 我是几次强制重启后出现的, 找了不少教程都没用, 最后还是保存数据文件,重装 amh 才 ok 的..
happywowwow
2016-08-10 10:37:12 +08:00
Inodes 满了?...
realpg
2016-08-10 10:53:23 +08:00
看楼上最开始那几层楼,笑喷了……
让人删配置文件……
wweir
2016-08-10 10:59:19 +08:00
你需要做的是缩小故障域。
mysqld 直接加参数 带上原来的 my.cnf 启动,看效果
liuzhedash
2016-08-10 11:12:57 +08:00
@realpg 删配置在特定条件下是有道理的:
1 、通过源码安装 mysql 到 /usr/local/mysql ,并启动服务,此时 my.cnf 路径在 /etc
2 、通过软件源安装 mysql-common ,会在 /etc/mysql 下放一个 my.cnf
3 、此时重启 mysql ,默认会读取 /etc/mysql/my.cnf ,所以找不到 pid 文件( pid 文件在 /usr/local/mysql )
4 、删除 /etc/mysql 下的 my.cnf , mysql 就会读取 /etc 下的 my.cnf ,于是一切都正常了

这个本质问题是读错了配置文件,当然不一定符合事实情况,而且这一票教程都没解释原因。。。
SmiteChow
2016-08-10 11:23:26 +08:00
备份一下数据,重新安装。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/298274

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX