错误!找不到 MySQL 管理器或服务器 PID 文件!威联通

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17424863/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 18:03:05  来源:igfitidea点击:

ERROR! MySQL manager or server PID file could not be found! QNAP

mysqlpidqnap

提问by adprocas

I am having an issue where MySQL isn't starting on my QNAP NAS.

我的 QNAP NAS 上没有启动 MySQL 的问题。

I found this first by not being able to log in through phpMyAdmin - was getting error:

我首先发现这个是因为无法通过 phpMyAdmin 登录 - 出现错误:

#2002 Cannot log in to the MySQL server

I then went to attempt to start mysql, as I guess this is a common issue with this, but it just gave a generic error.

然后我去尝试启动 mysql,因为我猜这是一个常见问题,但它只是给出了一个通用错误。

I went through troubleshooting the mysql.sock file and everything, changing its permissions, but nothing is working.

我对 mysql.sock 文件和所有内容进行了故障排除,更改了其权限,但没有任何效果。

I have rebooted my NAS many times.

我已经多次重启我的 NAS。

I eventually tried to restart mysql. In doing so I get:

我最终尝试重新启动mysql。这样做我得到:

ERROR! MySQL manager or server PID file could not be found!

I can't find anything specific to the QNAP or any general type troubleshooting for this. Everything I find seems to be OSX related.

我找不到任何特定于 QNAP 或任何一般类型的故障排除。我发现的一切似乎都与 OSX 相关。

采纳答案by adprocas

I ended up figuring this out on my own.

我最终自己解决了这个问题。

In searching for my logs I went into

在搜索我的日志时,我进入了

cd /usr/local/mysql/var

In there I found the file named [MyNAS].pid (replace [MyNAS] with the name of your NAS.

在那里我找到了名为 [MyNAS].pid 的文件(将 [MyNAS] 替换为您的 NAS 名称。

I then ran the following to remove the file

然后我运行以下命令删除文件

rm -rf /usr/local/mysql/var/[MyNAS].pid

I then restarted mysql

然后我重新启动了mysql

[/usr/local/mysql/var] # /etc/init.d/mysqld.sh restart        
/mnt/ext/opt/mysql
/mnt/ext/opt/mysql
Try to shutting down MySQL
ERROR! MySQL manager or server PID file could not be found!
/mnt/ext/opt/mysql
Starting MySQL. SUCCESS! 

I tested everything and it all works like a charm again!

我测试了所有东西,它再次像魅力一样工作!

回答by jeffwtribble

After a lot of searching, I was able to fix the "PID file cannot be found" issue on my machine. I'm on OS X 10.9.3 and installed mysql via Homebrew.

经过大量搜索,我能够在我的机器上修复“找不到 PID 文件”的问题。我在 OS X 10.9.3 上并通过 Homebrew 安装了 mysql。

First, I found my PID file here:

首先,我在这里找到了我的 PID 文件:

/usr/local/var/mysql/{username}.pid

Next, I located my my.cnf file here:

接下来,我在这里找到了 my.cnf 文件:

/usr/local/Cellar/mysql/5.6.19/my.cnf

Finally, I added this line to the bottom of my.cnf:

最后,我将这一行添加到 my.cnf 的底部:

pid-file = /usr/local/var/mysql/{username}.pid

Hopefully this works for someone else, and saves you a headache! Don't forget to replace {username} with your machine's name (jeffs-air-2 in my case).

希望这对其他人有用,并为您省去头疼的麻烦!不要忘记将 {username} 替换为您机器的名称(在我的情况下为 jeffs-air-2)。

回答by Yoosaf Abdulla

I tried everything above, but saw no results until I got a hint from here: https://superuser.com/questions/159486/how-to-kill-process-in-mac-os-x-and-not-have-it-restart-on-its-own

我尝试了上面的所有方法,但是直到我从这里得到提示才看到任何结果:https: //superuser.com/questions/159486/how-to-kill-process-in-mac-os-x-and-not-have -it-restart-on-its-own

I eventually went over to the activity monitor in my Mac, force Quit the PID, and ran the command:

我最终转到 Mac 中的活动监视器,强制退出 PID,然后运行命令:

sudo /usr/local/mysql/support-files/mysql.server restart

The magic was done!!!

魔法完成了!!!

回答by Alvaro Mena

If you have installed MySQL using brew the best way to go would be with homebrew

如果您使用 brew 安装了 MySQL,最好的方法是使用 homebrew

brew services restart mysql

after you run that command, all the problems that the update generated will be resolved

运行该命令后,更新生成的所有问题都将得到解决

回答by Shabeer

Run the below commands and it will work.

运行以下命令,它将起作用。

Go to terminal and type

转到终端并输入

sudo chown -RL root:mysql /usr/local/mysql

sudo chown -RL mysql:mysql /usr/local/mysql/data

sudo /usr/local/mysql/support-files/mysql.server start

回答by Adrian Cid Almaguer

Just run mysqld(don't run as root) from your terminal. Your mysql server will restart and reset everything like shown in the picture below:

只需mysqld从终端运行(不要以 root 身份运行)。您的 mysql 服务器将重新启动并重置所有内容,如下图所示:

enter image description here

在此处输入图片说明

And use a command like so:

并使用如下命令:

mysql -u root -h 127.0.0.1

回答by Afrizal

ERROR! MySQL server PID file could not be found!

错误!找不到 MySQL 服务器 PID 文件!

This might be due to issues with disk space, disk inode usage or innodb corruption which may lead to the error.

这可能是由于磁盘空间问题、磁盘 inode 使用或 innodb 损坏可能导致错误。

The issue was with the pid file and the solution was:

问题出在 pid 文件上,解决方案是:

  1. SSH login to server as a root

  2. Create directory /var/run/mysql

  1. SSH 以 root 身份登录到服务器

  2. 创建目录/var/run/mysql

mkdir /var/run/mysql

mkdir /var/run/mysql

3) Create a file with name as mysqld.pid

3) 创建一个名为 mysqld.pid 的文件

touch mysqld.pid

触摸mysqld.pid

  1. Change its ownership and group to mysql:mysql

    chown mysql:mysql mysqld.pid

  2. Restart MySQL service

  1. 将其所有权和组更改为 mysql:mysql

    chown mysql:mysql mysqld.pid

  2. 重启 MySQL 服务

Done!

完毕!

回答by jokerster

Note: If you just want to stop MySQL server, this might be helpful.In my case, it kept on restarting as soon as I killed the process using PID. Also brew stopcommand didn't work as I installed without using homebrew. Then I went to mac system preferences and we have MySQL installed there. Just open it and stop the MySQL server and you're done. Here in the screenshot, you can find MySQL in bottom of system preferences.enter image description here

注意:如果您只想停止 MySQL 服务器,这可能会有所帮助。就我而言,只要我使用 PID 终止进程,它就会继续重新启动。也brew stop因为我没有使用自制安装命令没有工作。然后我去了 mac 系统首选项,我们在那里安装了 MySQL。只需打开它并停止 MySQL 服务器即可。在屏幕截图中,您可以在系统首选项底部找到 MySQL。在此处输入图片说明

回答by P-Didz

Check if your server is full first, thats a common reason (can't create the PID file because you have no space). Run this to check your disk usage..

首先检查您的服务器是否已满,这是一个常见原因(无法创建 PID 文件,因为您没有空间)。运行它以检查您的磁盘使用情况..

df -h

If you get something like this, you are full..

如果你得到这样的东西,你就饱了..

Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        40G   40G  6.3M 100% /

In that case, you need to start looking for what to delete to make room, or add an additional drive to your server.

在这种情况下,您需要开始寻找要删除的内容以腾出空间,或者向服务器添加额外的驱动器。

回答by user3924460

I had the same issue. It turns out I added incorrect variables to the my.cnf file. Once I removed them and restarted mysql started with no issue.

我遇到过同样的问题。事实证明我在 my.cnf 文件中添加了不正确的变量。一旦我删除它们并重新启动 mysql 就没有问题了。