Linux 未找到 MySql 服务器 PID
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17875582/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
MySql server PID not found
提问by MM PP
I have CentOS 6.4 with NGINX.
我有带有 NGINX 的 CentOS 6.4。
When I try to start/stop/restart
mysql server (/etc/init.d/mysqld restart)
I get this error:
当我尝试使用start/stop/restart
mysql 服务器时,出现(/etc/init.d/mysqld restart)
此错误:
MySQL server PID file could not be found! [FAILED]
Starting MySQL..The server quit without updating PID file ([FAILED]/mysql/mysqld.pid).
What can I do to solve this problem?
我能做些什么来解决这个问题?
Thanks!
谢谢!
采纳答案by Ciprian Stoica
I got the same error on a CentOS 6.3 where I upgraded MySQL to 5.6.14 but I kept the old my.cnf file. After upgrade, MySQL did not start anymore, giving me the same error as you described.
我在 CentOS 6.3 上遇到了同样的错误,我将 MySQL 升级到 5.6.14,但我保留了旧的 my.cnf 文件。升级后,MySQL 没有启动了,给我和你描述的一样的错误。
The problem was that I had this setting in my.cnf:
问题是我在 my.cnf 中有这个设置:
table_cache=2048
According to this link table_cache renamed table_open_cache..
根据此链接table_cache 重命名 table_open_cache..
"Seem like in 5.5 the system variable table_cache was renamed table_open_cache.. In 5.6 mysqld fails if it finds an unknown variable this means that upgrades from versions earlier than 5.5 can have problems if table_cache is specified in my.cnf."
“似乎在 5.5 中,系统变量 table_cache 被重命名为 table_open_cache。在 5.6 中,如果发现未知变量,mysqld 将失败,这意味着如果在 my.cnf 中指定了 table_cache,则从 5.5 之前的版本升级可能会出现问题。”
After I changed the above line to
在我将上面的行更改为
table_open_cache=2048
MySQL started perfectly.
MySQL 完美启动。
So, in the case you have MySQL 5.5+ (and maybe an older my.cnf), I suggest you to do the following:
因此,如果您有 MySQL 5.5+(可能还有较旧的 my.cnf),我建议您执行以下操作:
- remove my.cnf from /etc folder and try to start MySQL
- if MySQL starts, the the problem is in my.cnf. Comment/uncomment all the settings one by one in order to see which is causing the problem.
- 从 /etc 文件夹中删除 my.cnf 并尝试启动 MySQL
- 如果 MySQL 启动,则问题出在 my.cnf 中。一一注释/取消注释所有设置,以查看导致问题的原因。
Hope this helps.
希望这可以帮助。
回答by arpiagar
I upgraded my Mac OS to 10.9.3 and encountered the above problem on mysql.server restart
我将我的 Mac OS 升级到 10.9.3 并在 mysql.server 重启时遇到了上述问题
The following fixed my problem
以下解决了我的问题
sudo chmod -R o+rwx /usr/local/var/mysql/
sudo chown -R mysql /usr/local/var/mysql/
sudo mysql.server restart
回答by Selwyn Polit
I find that sometimes MySQL processes are still running. Certainly this was the case on my OS X Yosemite system so use the following command to find any processes that show up with MySQL in the name:
我发现有时 MySQL 进程仍在运行。当然,我的 OS X Yosemite 系统就是这种情况,因此请使用以下命令查找名称中显示为 MySQL 的任何进程:
ps aux | grep mysql
Then kill them using the command
sudo kill -9 PID
, replacing PID
with the offending process ID.
然后使用命令杀死它们
sudo kill -9 PID
,替换为PID
有问题的进程 ID。
回答by giuseppe
Check if there is a lock.
检查是否有锁。
/etc/init.d/mysql status
If the OS says that there is a lock, something like:
如果操作系统说有锁,例如:
ERROR! MySQL is not running, but lock file (/var/lock/subsys/mysql) exists
remove that lock file and restart.
删除该锁定文件并重新启动。
回答by jafo
I found this worked....
我发现这有效....
# ps aux | grep mysql
root 3668 0.0 0.0 11432 1240 ? S 2014 0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/db/data01 --pid-file=/var/lib/mysql/mysql.pid
mysql 5303 0.1 0.4 1964748 12368 ? S<l 2014 1663:35 /usr/sbin/mysqld --basedir=/usr --datadir=/db/data01 --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/db/logs01/mysql-error.err --open-files-limit=8192 --pid-file=/var/lib/mysql/mysql.pid --socket=/var/lib/mysql/mysql.sock --port=3306
root 12369 0.0 0.0 6376 680 pts/0 S+ 09:05 0:00 grep mysql
# kill -9 3668 5303
# rm /var/lock/subsys/mysql rm: remove regular empty file `/var/lock/subsys/mysql'? y
# service mysql start Starting MySQL (Percona Server).. SUCCESS!
回答by Balkrushna Patil
First of all make sure that which folder/file is not exist in /var/run/mysqld/mysqld.pid
首先确保 /var/run/mysqld/mysqld.pid 中不存在哪个文件夹/文件
if dir not exists then create it as:
如果 dir 不存在,则将其创建为:
sudo mkdir -p /var/run/mysqld/
if mysqld.pid is not exists then create it as:
如果 mysqld.pid 不存在,则将其创建为:
sudo touch /var/run/mysqld/mysqld.pid
change ownership as:
将所有权更改为:
sudo chown mysql:mysql -R /var/run/mysqld
chmod 775 -R /var/run/mysqld
restart mysql service
重启mysql服务
sudo service mysql restart