mysqld_safe Fatal error: Can't remove the pid file

我之前在 Mac上安装MySQL,brew install mysql,之后长时间没有使用,在执行mysql.server start时报一下错误:

/usr/local/Cellar/mysql/8.0.12/bin/mysqld_safe: line 674: /usr/local/var/mysql/zhangxideMacBook-Air.local.err: Permission denied
Logging to '/usr/local/var/mysql/zhangxideMacBook-Air.local.err'.
rm: /usr/local/var/mysql/zhangxideMacBook-Air.local.pid: Permission denied
2018-09-29T08:35:35.6NZ mysqld_safe Fatal error: Can't remove the pid file:
/usr/local/var/mysql/zhangxideMacBook-Air.local.pid.
Please remove the file manually and start /usr/local/Cellar/mysql/8.0.12/bin/mysqld_safe again;
mysqld daemon not started
/usr/local/Cellar/mysql/8.0.12/bin/mysqld_safe: line 144: /usr/local/var/mysql/zhangxideMacBook-Air.local.err: Permission denied

我这边出现这个问题主要是我没有权限开启mysql,解决方法 掐面添加sudo

sudo mysql.server start

执行后:

⇒  sudo mysql.server start
Password:
Starting MySQL
 SUCCESS!
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容