另一个macOS升级+另一个MySQL升级=另一组问题。
我似乎无法让MySQL 8.0.18在macOS 10.15 Catalina上作为自制软件运行。请告诉我我的方式的错误。
这是我所做的:
这就是我的期望:
MySQL可以作为root用户作为自制程序愉快地运行。
这是发生了什么:
MySQL崩溃并死亡,在/usr/local/var/mysql/[host.domain.com].err
中留下了一个模糊的最后一个语句:
"[ERROR] [MY-010123] [Server] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!"
其他信息:
只要我手动启动,MySQL通过随后的重新启动即可正常运行:
sudo reboot now
ssh [servername.domain.com]
touch /tmp/mysql.sock
mysql.server start
这是/usr/local/var/mysql/[servername.domain.com].err
文件的内容:
2019-10-20T18:02:14.6NZ mysqld_safe Logging to '/usr/local/var/mysql/moriarty.farces.com.err'.
2019-10-20T18:02:14.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
2019-10-20T18:02:14.670494Z 0 [System] [MY-010116] [Server] /usr/local/Cellar/mysql/8.0.18/bin/mysqld (mysqld 8.0.18) starting as process 557
2019-10-20T18:02:14.685511Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2019-10-20T18:02:15.617696Z 0 [System] [MY-010229] [Server] Starting crash recovery...
2019-10-20T18:02:15.626461Z 0 [System] [MY-010232] [Server] Crash recovery finished.
2019-10-20T18:02:15.795626Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2019-10-20T18:02:15.833541Z 0 [System] [MY-010931] [Server] /usr/local/Cellar/mysql/8.0.18/bin/mysqld: ready for connections. Version: '8.0.18' socket: '/tmp/mysql.sock' port: 3306 Homebrew.
2019-10-20T18:02:15.993739Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/tmp/mysqlx.sock' bind-address: '127.0.0.1' port: 33060
重新启动后,当我尝试将MySQL作为Homebrew服务运行时:
sudo reboot now
ssh [servername.domain.com]
sudo brew services start mysql
MySQL失败,并在/usr/local/var/mysql/[servername.domain.com].err
文件中记录了以下错误:
2019-10-20T18:44:13.780394Z 0 [ERROR] [MY-010123] [Server] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
2019-10-20T18:44:13.780503Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-10-20T18:44:13.780727Z 0 [System] [MY-010910] [Server] /usr/local/opt/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.18) Homebrew.
2019-10-20T18:44:13.6NZ mysqld_safe mysqld from pid file /usr/local/var/mysql/moriarty.farces.com.pid ended
答案 0 :(得分:1)
哦,天哪,他摇了摇头...
这是RTFM的情况,我没有。这是《 MySQL 8.0参考手册》中的applicable page。这是神奇的juju:
将user=root
添加到[mysqld]
文件的/usr/local/etc/my.cnf
部分,如下所示:
# Default Homebrew MySQL server config
[mysqld]
# Only allow connections from localhost
bind-address = 127.0.0.1
mysqlx-bind-address = 127.0.0.1
user=root
答案 1 :(得分:0)
MySQL拒绝在Catalina上启动,因为运行它需要提升的特权。
您需要首先找到MySQL bin
目录:
which mysqld
您得到的结果应该类似于 /usr/local/mysql/bin/mysql
。
support-files
目录包含启动MySQL所需的必需脚本,并且位于bin
目录所在的目录中。在上面的示例中,支持文件目录将为/usr/local/mysql/support-files/
。
使用以下管理特权启动MySQL服务:
sudo /usr/local/mysql/support-files/mysql.server start
N.B::如果您运行的第一个命令的输出与上面的命令不同,请如上所述调整support-files
目录。
答案 2 :(得分:0)
切勿将sudo
与命令brew
一起使用。它将破坏相关文件的所有权。不支持以root用户身份运行brew
。
tl; dr Sudo很危险,您始终没有安装sudo就安装了TextMate.app。
自制软件拒绝使用
sudo
进行工作。
check-run-command-as-root() {
...
odie <<EOS
Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.
EOS
}
禁用该服务并删除启动守护程序。
# stop and unload the launchdaemon
sudo launchctl unload -w /Library/LaunchDaemons/homebrew.mxcl.mysql.plist
# remove the lauchdaemon file
sudo rm -f /Library/LaunchDaemons/homebrew.mxcl.mysql.plist
sudo rm -f /tmp/mysql.sock /tmp/mysqlx.sock
修复/usr/local/
下文件的所有权
sudo chown -R "$(whoami):admin" /usr/local/*
# it will take some time
重新启用MySQL服务。
# DO NOT USE "sudo brew"
brew services start mysql
最后,大声念出以下单词:我再也不会将sudo
与brew
一起使用了。
答案 3 :(得分:-1)
升级到Catalina后,我刚遇到相同的问题。 如果我从系统偏好设置启动MySQL服务器,它将自行启动和停止。对我来说,解决方案是:
sudo /usr/local/mysql-8.0.17-macos10.14-x86_64/support-files/mysql.server start
代替:/usr/local/mysql/support-files/mysql.server start
我在卡塔琳娜州遇到很多问题。现在我不能从系统偏好设置启动/停止mysql服务器,只能从终端启动/停止。
这是我的第一篇文章,因此希望对您有所帮助。由于您是我发现的唯一一个有相同问题的人,所以我只注册了此问题。
答案 4 :(得分:-1)
我这样解决:
完全删除MySQL,正在观看:https://gist.github.com/vitorbritto/0555879fe4414d18569d
使用Download do MySQL社区服务器安装MySQL
https://dev.mysql.com/downloads/mysql/
完成!成功!