无法在Mac上启动MySQL-权限被拒绝

时间:2018-12-10 21:47:12

标签: mysql macos terminal homebrew

我试图运行通过Mac(High Sierra)上的HomeBrew安装的MySQL,但是我总是遇到这些权限问题以及PID文件的问题。我已经尝试了数百种在网上找到的可能的解决方案,但无法解决这些问题:

Haline:/ Haline$ mysql.server start
Starting MySQL
./usr/local/Cellar/mysql/8.0.12/bin/mysqld_safe: line 144: /usr/local/var/mysql/Haline.local.err: Permission denied
/usr/local/Cellar/mysql/8.0.12/bin/mysqld_safe: line 144: /usr/local/var/mysql/Haline.local.err: Permission denied
/usr/local/Cellar/mysql/8.0.12/bin/mysqld_safe: line 199: /usr/local/var/mysql/Haline.local.err: Permission denied
/usr/local/Cellar/mysql/8.0.12/bin/mysqld_safe: line 144: /usr/local/var/mysql/Haline.local.err: Permission denied
 ERROR! The server quit without updating PID file (/usr/local/var/mysql/Haline.local.pid).

请问有人可以帮助我吗?

1 个答案:

答案 0 :(得分:1)

根据官方troubleshooting page of Homebrew

  

如果命令由于权限错误而失败,请检查/ usr / local的子目录的权限。如果不确定该怎么办,可以运行cd /usr/local && sudo chown -R $(whoami) bin etc include lib sbin share var opt Cellar Caskroom Frameworks

或者,如果您没有在/usr/local中安装依赖特定权限的应用程序,则还可以运行:

sudo chown -R $(whoami) /usr/local/*