MySQL pid 结束(无法启动 mysql)

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

MySQL pid ended (cannot start mysql)

mysqldatabasemacosmysql-error-1064

提问by Danny Englander

I have a clean install of MySQL (mysql-5.5.24-osx10.6-x86_64). I am on Lion (OS 10.7.4) with a Mac Pro Quad Core. I installed MySQL the GUI installer and also installed the pref pane and the startup item.

我有一个全新安装的 MySQL (mysql-5.5.24-osx10.6-x86_64)。我使用的是带有 Mac Pro 四核的 Lion(操作系统 10.7.4)。我安装了 MySQL GUI 安装程序,还安装了首选项窗格和启动项。

However when I run:

但是,当我运行时:

sudo ./bin/mysqld_safe

I get this message:

我收到这条消息:

120515 17:58:19 mysqld_safe Logging to '/usr/local/mysql-5.5.24-osx10.6-x86_64/data/Dannys-Mac-Pro.local.err'.
120515 17:58:19 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql-5.5.24-osx10.6-x86_64/data
120515 17:58:20 mysqld_safe mysqld from pid file /usr/local/mysql-5.5.24-osx10.6-x86_64/data/Dannys-Mac-Pro.local.pid ended

I also cannot start MySQL from the preference pane.

我也无法从首选项窗格启动 MySQL。

Here is what I have tried so far based on the hours of Googling and research today:

根据今天的谷歌搜索和研究时间,这是我迄今为止所尝试的:

Permissions issues?

权限问题?

This:

这个:

cd /usr/local
sudo chown mysql mysql
sudo chown mysql mysql-5.5.24-osx10.6-x86_64
sudo chown _mysql mysql
sudo chown _mysql mysql-5.5.24-osx10.6-x86_64

and

sudo chown -R /usr/local/mysql-5.5.24-osx10.6-x86_64/
sudo chown -R /usr/local/mysql

This:

这个:

sudo chown -R root:wheel /Library/StartupItems/MySQLCOM

Link issues?

链接问题?

This:

这个:

in /usr/local/mysql/support-files/mysql.server -- I did:

在 /usr/local/mysql/support-files/mysql.server - 我做了:

basedir="/usr/local/mysql"
datadir="/usr/local/mysql/data"

In the file /etc/rc.common add the follow line at end: /usr/local/mysql/bin/mysqld_safe --user=mysql &

在文件 /etc/rc.common 末尾添加以下行: /usr/local/mysql/bin/mysqld_safe --user=mysql &

This:

这个:

sudo ln -s /usr/local/mysql-5.5.24-osx10.6-x86_64 /usr/local/mysql

I also tried the removal process hereand reinstalled but this did not seem to make a difference. I also launched Activity Monitor in OS X to see if any other mySQL processes were running by chance but they were not.

我也在这里尝试了删除过程并重新安装,但这似乎没有什么区别。我还在 OS X 中启动了 Activity Monitor,以查看是否有任何其他 mySQL 进程偶然运行,但它们没有。

Nothing above worked so I am sort of at wits end. Here is the log from the .err file located at:

以上都没有奏效,所以我有点不知所措。这是 .err 文件中的日志,位于:

/usr/local/mysql-5.5.24-osx10.6-x86_64/data/Dannys-Mac-Pro.local.err

120515 18:07:43 mysqld_safe mysqld from pid file /usr/local/mysql-5.5.24-osx10.6-x86_64/data/Dannys-Mac-Pro.local.pid ended
120515 18:13:01 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql-5.5.24-osx10.6-x86_64/data
120515 18:13:01 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql-5.5.24-osx10.6-x86_64/data/ is case insensitive
120515 18:13:01 [Note] Plugin 'FEDERATED' is disabled.
/usr/local/mysql-5.5.24-osx10.6-x86_64/bin/mysqld: Table 'mysql.plugin' doesn't exist
120515 18:13:01 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
120515 18:13:01 InnoDB: The InnoDB memory heap is disabled
120515 18:13:01 InnoDB: Mutexes and rw_locks use GCC atomic builtins
120515 18:13:01 InnoDB: Compressed tables use zlib 1.2.3
120515 18:13:01 InnoDB: Initializing buffer pool, size = 128.0M
120515 18:13:01 InnoDB: Completed initialization of buffer pool
120515 18:13:01 InnoDB: highest supported file format is Barracuda.
120515 18:13:01  InnoDB: Waiting for the background threads to start
120515 18:13:02 InnoDB: 1.1.8 started; log sequence number 1595675
120515 18:13:02 [ERROR] /usr/local/mysql-5.5.24-osx10.6-x86_64/bin/mysqld: unknown option '--skip-locking'
120515 18:13:02 [ERROR] Aborting

120515 18:13:02  InnoDB: Starting shutdown...
120515 18:13:03  InnoDB: Shutdown completed; log sequence number 1595675
120515 18:13:03 [Note] /usr/local/mysql-5.5.24-osx10.6-x86_64/bin/mysqld: Shutdown complete

120515 18:13:03 mysqld_safe mysqld from pid file /usr/local/mysql-5.5.24-osx10.6-x86_64/data/Dannys-Mac-Pro.local.pid ended

Update:I upgraded the same machine from Snow Leopard to Mountain Lion 10.8.1 and MySQL works perfectly fine now with the upgrade, I had to do nothing extra.

更新:我将同一台机器从 Snow Leopard 升级到 Mountain Lion 10.8.1,现在升级后 MySQL 工作得很好,我不需要做任何额外的事情。

回答by Qian Alvin. Qin

I have the same problem when installing mysql newest version mysql-5.6.10-osx10.7-x86.dmg for my MAC OS 10.7.5. Following is my solutions. First , delete the mysql installed

为我的 MAC OS 10.7.5 安装 mysql 最新版本 mysql-5.6.10-osx10.7-x86.dmg 时,我遇到了同样的问题。以下是我的解决方案。首先,删除安装的mysql

sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
sudo rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /var/db/receipts/com.mysql.*

Then, get mysql-5.1.68-osx10.6-x86.dmg, install this old version, and done!

然后,获取mysql-5.1.68-osx10.6-x86.dmg,安装这个旧版本,大功告成!

回答by Redrick

since I cannot post comments (got <50 reputation :( ) I am writing it here :)

因为我不能发表评论(获得 <50 声望:()我在这里写:)

as @AndPy says, the same with me, if you ls -lthe /usr/local/var/mysqlyou can see that the file COMPUTER-NAME.local.erris owned by _mysqlor some such.... in this case just erase the file and mysql.server startwill create new one owned by your user and will start properly this time :)

作为@AndPy说,跟我一样的,如果你ls -l/usr/local/var/mysql你可以看到,该文件COMPUTER-NAME.local.err是由拥有_mysql或一些这样的....在这种情况下,只是删除文件,mysql.server start将创建一个新的你的用户所拥有,并开始正常此时间 :)

If the file is already owned by your user, this wont help, you got to google more :(

如果该文件已归您的用户所有,这将无济于事,您必须更多地 google :(

回答by SomeThing

I found this error on redmine bitnami stack because owner of files in directory data incorrect.

我在 redmine bitnami 堆栈上发现了这个错误,因为目录数据中文件的所有者不正确。

Check owner of directory /mysql/data/ must be 'mysql' user

检查目录 /mysql/data/ 的所有者必须是 'mysql' 用户

Hope this help.

希望这有帮助。

回答by Michael Zumstein

I had the same problem after updating to OS X Mavericks.

更新到 OS X Mavericks 后我遇到了同样的问题。

Starting MySQL . ERROR! The server quit without updating PID file

启动 MySQL。错误!服务器退出而不更新PID文件

Like Redrickand AndPymentioned I also had to rename (actually I deleted the file) the error file located in $ cd /usr/local/var/mysql. My error file was called localhost.err. After removing the file with $ rm localhost.errI could finally start MySQL again with $ mysql.server start.

就像RedrickAndPy提到的,我还必须重命名(实际上我删除了文件)位于$ cd /usr/local/var/mysql. 我的错误文件被称为localhost.err. 删除文件后,$ rm localhost.err我终于可以再次启动 MySQL 了$ mysql.server start

回答by AndPy

I had the same problem.

我有同样的问题。

In /usr/local/var/mysql I found a file in the form COMPUTER-NAME.local.err. Simply changing that file name solved the problem. I could now start the mysql server with

在 /usr/local/var/mysql 中,我找到了一个格式为 COMPUTER-NAME.local.err 的文件。只需更改该文件名即可解决问题。我现在可以启动 mysql 服务器

mysql.server start

mysql.server 启动

回答by SpongeBobPHPPants

My answer is very similar to others, but slightly different and this applies mostly to a bitnami mamp stack. The fix for me was:

我的回答与其他人非常相似,但略有不同,这主要适用于 bitnami mamp 堆栈。对我来说修复是:

sudo chown -R mysql mysql/

sudo chown -R mysql mysql/

The mysql/directory is the one located in Applications/<mampstack-version>/

mysql/目录是位于Applications/<mampstack-version>/

The above sets the mysql to be the owner of the mysql directory recursively into the other directories.

以上将mysql设置为mysql目录的所有者,递归进入其他目录。

回答by user2582118

If you want to absolutely get this thing working do the following:

如果你想绝对让这件事正常工作,请执行以下操作:

You need to uninstall mysql first so do that, before you do this though, make sure you have a backup of all your DBs.

您需要先卸载 mysql,所以在执行此操作之前,请确保您备份了所有数据库。

brew remove mysql

brew remove mysql

Then you need to make sure certain files are uninstalled, make a batch script of the following commands and run it:

然后你需要确保某些文件被卸载,制作以下命令的批处理脚本并运行它:

sudo rm /usr/local/mysql
sudo rm -rf /usr/local/var/mysql
sudo rm -rf /usr/local/mysql*
sudo rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /private/var/db/receipts/*mysql*

Go to /etc/hostconfigusing your favorite editing program and remove the line MYSQLCOM=-YES-

转到/etc/hostconfig使用您最喜欢的编辑程序并删除该行MYSQLCOM=-YES-

Then run brew cleanupthen install mysql using brew install mysql

然后运行brew cleanup然后使用安装mysqlbrew install mysql

After you've done this you'll probably get the same error again. Head over to the folder cd /usr/local/var/mysql/. There should be a file in there called localhost.local.err

完成此操作后,您可能会再次遇到相同的错误。转到文件夹cd /usr/local/var/mysql/。那里应该有一个文件叫做localhost.local.err

run cat ./localhost.local.errand look in the file. You should see something similar to:

运行cat ./localhost.local.err并查看文件。您应该会看到类似于以下内容的内容:

2018-03-24 15:41:49 140735679804288 [ERROR] Can't start server: Bind on TCP/IP port. Got error: 48: Address already in use

2018-03-24 15:41:49 140735679804288 [ERROR] Can't start server: Bind on TCP/IP port. Got error: 48: Address already in use

2018-03-24 15:41:49 140735679804288 [ERROR] Do you already have another mysqld server running on port: 3306 ?

2018-03-24 15:41:49 140735679804288 [ERROR] Do you already have another mysqld server running on port: 3306 ?

If you do, run the command sudo lsof -i :3306and you'll probably get something back like this:

如果你这样做了,运行命令sudo lsof -i :3306,你可能会得到这样的结果:

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME mysqld 74 _mysql 20u IPv6 0xXXXXXXXXXXXXX 0t0 TCP *:mysql (LISTEN)

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME mysqld 74 _mysql 20u IPv6 0xXXXXXXXXXXXXX 0t0 TCP *:mysql (LISTEN)

This means mysql is already running and listening on port 3306 and you need to kill it. Use topto kill the program or just use Activity Monitor to kill it. Either way once that's done go back to cd /usr/local/var/mysql/and delete the folder localhost.local.err.

这意味着 mysql 已经在运行并侦听端口 3306,您需要终止它。使用top杀程序或只使用活动监视器来杀死它。无论哪种方式,一旦完成,请返回cd /usr/local/var/mysql/并删除文件夹localhost.local.err

Once that's done run mysql.server start and you should get the following:

完成后运行 mysql.server start ,你应该得到以下信息:

180324 15:46:18 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql SUCCESS!

180324 15:46:18 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql SUCCESS!

And congrats. I've been trying to fix this for a week and it's such an easy fix and I just figured it out. I hate myself.

并祝贺。我一直在尝试解决这个问题一个星期,这是一个非常简单的解决方法,我只是想通了。我恨我自己。

回答by John F

Only removing mysql-bin.indexfile in /usr/local/var/mysql/ helped me.

仅删除/usr/local/var/mysql/ 中的mysql-bin.index文件对我有帮助。

回答by Muhammad

120515 18:13:01 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.

120515 18:13:01 [错误] 无法打开 mysql.plugin 表。请运行 mysql_upgrade 来创建它。

  • Regarding this error, I assume that you have specified a datadir in my.cnf. If you are using a non-default data directory for MySQL, you need to move folders mysql and performance_schema (whichever exists) to the data directory specified in my.cnf. You can find these folders in mysql directory.
  • 关于这个错误,我假设你已经在 my.cnf 中指定了一个 datadir。如果您使用的是 MySQL 的非默认数据目录,则需要将文件夹 mysql 和 performance_schema(以存在者为准)移动到 my.cnf 中指定的数据目录。您可以在 mysql 目录中找到这些文件夹。

In MySQL 5.5+ the --skip-locking option is removed. Use --skip-external-locking instead. Refer to MySQL documentation --> http://dev.mysql.com/doc/refman/5.5/en/mysql-nutshell.htmlQuote: "The --enable-locking and --skip-locking server options (use --external-locking and --skip-external-locking)."

在 MySQL 5.5+ 中,删除了 --skip-locking 选项。改用 --skip-external-locking 。请参阅 MySQL 文档 --> http://dev.mysql.com/doc/refman/5.5/en/mysql-nutshell.html引用:“--enable-locking 和 --skip-locking 服务器选项(使用 - -external-locking 和--skip-external-locking)。”

回答by Nick Sarafa

Give this a whirl..

试一试吧..

  1. Navigate to the problem's parent directory cd YOURPATH/usr/local/mysql
  2. rm -rf *.local.err(deletes file)
  3. touch YOURUSERNAME.local.pid(generates new *.local.pid file the error thrown was complaining about)
  4. cd back into your project and restart mysql using mysql.server start
  1. 导航到问题的父目录 cd YOURPATH/usr/local/mysql
  2. rm -rf *.local.err(删除文件)
  3. touch YOURUSERNAME.local.pid(生成新的 *.local.pid 文件引发的错误抱怨)
  4. cd 回到您的项目并使用重新启动 mysql mysql.server start