错误!服务器退出而不更新PID文件(/usr/local/var/mysql/`username`.lan.pid)

问题描述 投票:0回答:4

我无法摆脱下面的错误。

  1. 通过
    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. 安装自制软件
  3. brew install mysql

  4. mysql.server start
    给出错误:
    ERROR! The server quit without updating PID file (/usr/local/var/mysql/
    用户名
    .lan.pid).

我尝试过的一些事情:

ps -ef | grep mysql
输出:

501  1196  1172   0  9:08PM ttys000    0:00.00 grep mysql

然后我尝试用

kill -9 1172
杀死它。这只是说
Process Complete
但随后一个新进程开始运行。不确定这是否与此有关。

我已使用

sudo chown -R mysql /usr/local/var/mysql/
更改所有权并尝试再次运行,但没有成功。

我尝试从目录

Macintosh HD⁩ ▸ ⁨usr⁩ ▸ ⁨local⁩ ▸ ⁨mysql-8.0.14-macos10.14-x86_64
运行它,但没有成功。

我尝试删除错误日志并重新运行。

我刚刚将 Mac 更新到 Mojave 10.14.3,但运气不佳。

我尝试过卸载并重新安装mysql。

我尝试通过下载链接安装mysql而不是

brew install

我尝试做

unset TMPDIR
mysql_install_db
,但我得到的回应:
-bash: mysql_install_db: command not found
。我尝试从 mysql-VERSION 文件夹内运行它。

我不知道还能尝试什么。感谢帮助。

.err file

2019-01-24T19:46:47.6NZ mysqld_safe Logging to '/usr/local/var/mysql/ryans-macbook.lan.err'.
2019-01-24T19:46:47.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
2019-01-24T19:46:47.525951Z 0 [System] [MY-010116] [Server] /usr/local/Cellar/mysql/8.0.13/bin/mysqld (mysqld 8.0.13) starting as process 78796
2019-01-24T19:46:47.529750Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2019-01-24T19:46:47.535680Z 1 [ERROR] [MY-012271] [InnoDB] The innodb_system data file 'ibdata1' must be writable
2019-01-24T19:46:47.535720Z 1 [ERROR] [MY-012278] [InnoDB] The innodb_system data file 'ibdata1' must be writable
2019-01-24T19:46:47.535747Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2019-01-24T19:46:47.535869Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2019-01-24T19:46:47.535891Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-01-24T19:46:47.536598Z 0 [System] [MY-010910] [Server] /usr/local/Cellar/mysql/8.0.13/bin/mysqld: Shutdown complete (mysqld 8.0.13)  Homebrew.
2019-01-24T19:46:47.6NZ mysqld_safe mysqld from pid file /usr/local/var/mysql/-macbook.lan.pid ended
2019-01-24T19:47:05.6NZ mysqld_safe Logging to '/usr/local/var/mysql/-macbook.lan.err'.
2019-01-24T19:47:05.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
2019-01-24T19:47:05.861015Z 0 [System] [MY-010116] [Server] /usr/local/Cellar/mysql/8.0.13/bin/mysqld (mysqld 8.0.13) starting as process 78949
2019-01-24T19:47:05.864718Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2019-01-24T19:47:05.871046Z 1 [ERROR] [MY-012271] [InnoDB] The innodb_system data file 'ibdata1' must be writable
2019-01-24T19:47:05.871084Z 1 [ERROR] [MY-012278] [InnoDB] The innodb_system data file 'ibdata1' must be writable
2019-01-24T19:47:05.871110Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2019-01-24T19:47:05.871264Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2019-01-24T19:47:05.871290Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-01-24T19:47:05.871961Z 0 [System] [MY-010910] [Server] /usr/local/Cellar/mysql/8.0.13/bin/mysqld: Shutdown complete (mysqld 8.0.13)  Homebrew.
2019-01-24T19:47:05.6NZ mysqld_safe mysqld from pid file /usr/local/var/mysql/-macbook.lan.pid ended
2019-01-24T19:51:27.6NZ mysqld_safe Logging to '/usr/local/var/mysql/-macbook.lan.err'.
2019-01-24T19:51:27.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
2019-01-24T19:51:27.979873Z 0 [System] [MY-010116] [Server] /usr/local/Cellar/mysql/8.0.13/bin/mysqld (mysqld 8.0.13) starting as process 81867
2019-01-24T19:51:27.983686Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2019-01-24T19:51:27.998082Z 1 [ERROR] [MY-012271] [InnoDB] The innodb_system data file 'ibdata1' must be writable
2019-01-24T19:51:27.998131Z 1 [ERROR] [MY-012278] [InnoDB] The innodb_system data file 'ibdata1' must be writable
2019-01-24T19:51:27.998159Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2019-01-24T19:51:27.998299Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2019-01-24T19:51:27.998328Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-01-24T19:51:27.999095Z 0 [System] [MY-010910] [Server] /usr/local/Cellar/mysql/8.0.13/bin/mysqld: Shutdown complete (mysqld 8.0.13)  Homebrew.
2019-01-24T19:51:28.6NZ mysqld_safe mysqld from pid file /usr/local/var/mysql/-macbook.lan.pid ended
2019-01-24T19:52:04.6NZ mysqld_safe Logging to '/usr/local/var/mysql/-macbook.lan.err'.
2019-01-24T19:52:04.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
2019-01-24T19:52:04.660514Z 0 [System] [MY-010116] [Server] /usr/local/Cellar/mysql/8.0.13/bin/mysqld (mysqld 8.0.13) starting as process 82584
2019-01-24T19:52:04.664208Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2019-01-24T19:52:04.670173Z 1 [ERROR] [MY-012271] [InnoDB] The innodb_system data file 'ibdata1' must be writable
2019-01-24T19:52:04.670215Z 1 [ERROR] [MY-012278] [InnoDB] The innodb_system data file 'ibdata1' must be writable
2019-01-24T19:52:04.670239Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2019-01-24T19:52:04.670387Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2019-01-24T19:52:04.670416Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-01-24T19:52:04.671195Z 0 [System] [MY-010910] [Server] /usr/local/Cellar/mysql/8.0.13/bin/mysqld: Shutdown complete (mysqld 8.0.13)  Homebrew.
2019-01-24T19:52:04.6NZ mysqld_safe mysqld from pid file /usr/local/var/mysql/-macbook.lan.pid ended
2019-01-24T19:53:38.6NZ mysqld_safe Logging to '/usr/local/var/mysql/-macbook.lan.err'.
2019-01-24T19:53:38.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
2019-01-24T19:53:38.430888Z 0 [System] [MY-010116] [Server] /usr/local/Cellar/mysql/8.0.13/bin/mysqld (mysqld 8.0.13) starting as process 82806
2019-01-24T19:53:38.434733Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2019-01-24T19:53:38.905784Z 0 [Warning] [MY-000054] [Server] World-writable config file './auto.cnf' is ignored.
2019-01-24T19:53:38.905899Z 0 [Warning] [MY-010107] [Server] World-writable config file './auto.cnf' has been removed.
2019-01-24T19:53:38.905985Z 0 [Warning] [MY-010075] [Server] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: be330a06-2011-11e9-8f30-eeb7cad0b310.
2019-01-24T19:53:38.921773Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2019-01-24T19:53:38.928389Z 0 [ERROR] [MY-010262] [Server] Can't start server: Bind on TCP/IP port: Address already in use
2019-01-24T19:53:38.928416Z 0 [ERROR] [MY-010257] [Server] Do you already have another mysqld server running on port: 3306 ?
2019-01-24T19:53:38.928458Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-01-24T19:53:40.656950Z 0 [System] [MY-010910] [Server] /usr/local/Cellar/mysql/8.0.13/bin/mysqld: Shutdown complete (mysqld 8.0.13)  Homebrew.
2019-01-24T19:53:40.6NZ mysqld_safe mysqld from pid file /usr/local/var/mysql/-macbook.lan.pid ended
2019-01-24T19:59:06.6NZ mysqld_safe Logging to '/usr/local/var/mysql/-macbook.lan.err'.
2019-01-24T19:59:06.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
2019-01-24T19:59:07.597870Z 0 [System] [MY-010116] [Server] /usr/local/Cellar/mysql/8.0.13/bin/mysqld (mysqld 8.0.13) starting as process 679
2019-01-24T19:59:07.682119Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2019-01-24T19:59:08.398625Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2019-01-24T19:59:08.410090Z 0 [ERROR] [MY-010262] [Server] Can't start server: Bind on TCP/IP port: Address already in use
2019-01-24T19:59:08.410134Z 0 [ERROR] [MY-010257] [Server] Do you already have another mysqld server running on port: 3306 ?
2019-01-24T19:59:08.410179Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-01-24T19:59:09.753682Z 0 [System] [MY-010910] [Server] /usr/local/Cellar/mysql/8.0.13/bin/mysqld: Shutdown complete (mysqld 8.0.13)  Homebrew.
2019-01-24T19:59:09.6NZ mysqld_safe mysqld from pid file /usr/local/var/mysql/-macbook.lan.pid ended
2019-01-29T03:49:55.6NZ mysqld_safe Logging to '/usr/local/var/mysql/-macbook.lan.err'.
2019-01-29T03:49:56.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
2019-01-29T03:49:56.312175Z 0 [System] [MY-010116] [Server] /usr/local/Cellar/mysql/8.0.13/bin/mysqld (mysqld 8.0.13) starting as process 17447
2019-01-29T03:49:56.315809Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2019-01-29T03:49:56.760978Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2019-01-29T03:49:56.768674Z 0 [ERROR] [MY-010262] [Server] Can't start server: Bind on TCP/IP port: Address already in use
2019-01-29T03:49:56.768706Z 0 [ERROR] [MY-010257] [Server] Do you already have another mysqld server running on port: 3306 ?
2019-01-29T03:49:56.768735Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-01-29T03:49:58.135724Z 0 [System] [MY-010910] [Server] /usr/local/Cellar/mysql/8.0.13/bin/mysqld: Shutdown complete (mysqld 8.0.13)  Homebrew.
2019-01-29T03:49:58.6NZ mysqld_safe mysqld from pid file /usr/local/var/mysql/-macbook.lan.pid ended
2019-01-29T04:35:11.6NZ mysqld_safe Logging to '/usr/local/var/mysql/-macbook.lan.err'.
2019-01-29T04:35:11.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
2019-01-29T04:35:11.604233Z 0 [System] [MY-010116] [Server] /usr/local/Cellar/mysql/8.0.13/bin/mysqld (mysqld 8.0.13) starting as process 17821
2019-01-29T04:35:11.607955Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2019-01-29T04:35:11.904189Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2019-01-29T04:35:11.910582Z 0 [ERROR] [MY-010262] [Server] Can't start server: Bind on TCP/IP port: Address already in use
2019-01-29T04:35:11.910605Z 0 [ERROR] [MY-010257] [Server] Do you already have another mysqld server running on port: 3306 ?
2019-01-29T04:35:11.910638Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-01-29T04:35:13.403138Z 0 [System] [MY-010910] [Server] /usr/local/Cellar/mysql/8.0.13/bin/mysqld: Shutdown complete (mysqld 8.0.13)  Homebrew.
2019-01-29T04:35:13.6NZ mysqld_safe mysqld from pid file /usr/local/var/mysql/-macbook.lan.pid ended
2019-01-29T04:38:23.6NZ mysqld_safe Logging to '/usr/local/var/mysql/-macbook.lan.err'.
2019-01-29T04:38:23.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
2019-01-29T04:38:23.883516Z 0 [System] [MY-010116] [Server] /usr/local/Cellar/mysql/8.0.13/bin/mysqld (mysqld 8.0.13) starting as process 17989
2019-01-29T04:38:23.887192Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
mysqld: File './binlog.index' not found (OS errno 13 - Permission denied)
2019-01-29T04:38:23.887568Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-01-29T04:38:23.887755Z 0 [System] [MY-010910] [Server] /usr/local/Cellar/mysql/8.0.13/bin/mysqld: Shutdown complete (mysqld 8.0.13)  Homebrew.
2019-01-29T04:38:23.6NZ mysqld_safe mysqld from pid file /usr/local/var/mysql/-macbook.lan.pid ended
2019-01-29T04:39:48.6NZ mysqld_safe Logging to '/usr/local/var/mysql/-macbook.lan.err'.
2019-01-29T04:39:48.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
2019-01-29T04:39:49.266658Z 0 [System] [MY-010116] [Server] /usr/local/Cellar/mysql/8.0.13/bin/mysqld (mysqld 8.0.13) starting as process 18103
2019-01-29T04:39:49.270279Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2019-01-29T04:39:49.587646Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2019-01-29T04:39:49.593469Z 0 [ERROR] [MY-010262] [Server] Can't start server: Bind on TCP/IP port: Address already in use
2019-01-29T04:39:49.593491Z 0 [ERROR] [MY-010257] [Server] Do you already have another mysqld server running on port: 3306 ?
2019-01-29T04:39:49.593525Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-01-29T04:39:50.983373Z 0 [System] [MY-010910] [Server] /usr/local/Cellar/mysql/8.0.13/bin/mysqld: Shutdown complete (mysqld 8.0.13)  Homebrew.
2019-01-29T04:39:51.6NZ mysqld_safe mysqld from pid file /usr/local/var/mysql/-macbook.lan.pid ended
2019-01-29T05:04:29.6NZ mysqld_safe Logging to '/usr/local/var/mysql/-macbook.lan.err'.
2019-01-29T05:04:29.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
2019-01-29T05:04:30.224737Z 0 [System] [MY-010116] [Server] /usr/local/Cellar/mysql/8.0.13/bin/mysqld (mysqld 8.0.13) starting as process 989
2019-01-29T05:04:30.245235Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2019-01-29T05:04:30.797676Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2019-01-29T05:04:30.805231Z 0 [ERROR] [MY-010262] [Server] Can't start server: Bind on TCP/IP port: Address already in use
2019-01-29T05:04:30.805265Z 0 [ERROR] [MY-010257] [Server] Do you already have another mysqld server running on port: 3306 ?
2019-01-29T05:04:30.805300Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-01-29T05:04:32.175755Z 0 [System] [MY-010910] [Server] /usr/local/Cellar/mysql/8.0.13/bin/mysqld: Shutdown complete (mysqld 8.0.13)  Homebrew.
2019-01-29T05:04:32.6NZ mysqld_safe mysqld from pid file /usr/local/var/mysql/-macbook.lan.pid ended
2019-01-29T05:39:19.6NZ mysqld_safe Logging to '/usr/local/var/mysql/-macbook.lan.err'.
2019-01-29T05:39:19.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
2019-01-29T05:39:19.544597Z 0 [System] [MY-010116] [Server] /usr/local/Cellar/mysql/8.0.13/bin/mysqld (mysqld 8.0.13) starting as process 1882
2019-01-29T05:39:19.551070Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2019-01-29T05:39:19.984015Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2019-01-29T05:39:19.991348Z 0 [ERROR] [MY-010262] [Server] Can't start server: Bind on TCP/IP port: Address already in use
2019-01-29T05:39:19.991394Z 0 [ERROR] [MY-010257] [Server] Do you already have another mysqld server running on port: 3306 ?
2019-01-29T05:39:19.991430Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-01-29T05:39:21.359167Z 0 [System] [MY-010910] [Server] /usr/local/Cellar/mysql/8.0.13/bin/mysqld: Shutdown complete (mysqld 8.0.13)  Homebrew.
2019-01-29T05:39:21.6NZ mysqld_safe mysqld from pid file /usr/local/var/mysql/-macbook.lan.pid ended
mysql macos homebrew
4个回答
29
投票

问题:

当我使用自制程序安装mysql时,我也遇到了同样的问题。在这种情况下,它来自上一个 mysql 版本所获取的

/usr/local/var/mysql/
权限。即使我们使用
sudo mysql.server
,它仍然是错误。

$ mysql.server start
Starting MySQL
. ERROR! The server quit without updating PID file (/usr/local/var/mysql/[username].local.pid).

解决方案:

!!警告:这将删除您的数据库!

这是我的解决方案,我删除了

mysql
处的
/usr/local/var/mysql/
目录,然后再次开始使用自制程序重新安装。 我解决的问题对我来说很有用:

$ sudo rm -rf /usr/local/var/mysql
$ brew reinstall mysql

结果:

$ mysql.server start
Starting MySQL
. SUCCESS! 

1
投票

我尝试了Sen Sokha的解决方案,但似乎不起作用。按照另一个 thread 中的建议,我 cd 到

/usr/local/var/mysql
然后运行
vim [my-computer's-name].local.err
来读取错误日志,这给了我这个:
[ERROR] Can't start server: Bind on TCP/IP port: Address already in use.

然后我按照这个线程并运行

lsof -i TCP:3306
来检查那里已经运行的内容,然后
kill 566
(566是PID)来停止它。我跑了
mysql.server start
,这次成功了!


0
投票

根据日志,您的 datadir

/usr/local/var/mysql/
具有错误的权限。

Homebrew 似乎使用 brew 的当前用户 ,并且该用户应该拥有 datadir 及其下面的所有内容。

mysql_install_db 在 MySQL-8.0 中被删除。


-1
投票

如果使用 Apple Silicon 处理器,请运行以下命令来删除 mysql 目录

sudo rm -rf /opt/homebrew/var/mysql/ 

然后重启mysql

brew services restart mysql
© www.soinside.com 2019 - 2024. All rights reserved.