mac brew 安装 mysql8 无法启动

2023-02-15 16:01:32 +08:00
 silverdog
Starting MySQL
. ERROR! The server quit without updating PID file (/usr/local/var/mysql/MacBook-Pro-3.local.pid).



xxxxx@MacBook-Pro-3 ~ % brew services info mysql
mysql (homebrew.mxcl.mysql)
Running: ✔
Loaded: ✔
Schedulable: ✘
User: root
PID: 598
xxxxx@MacBook-Pro-3 ~ % mysql
mysql: [Warning] World-writable config file '/etc/my.cnf' is ignored.
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/Users/xxxxx/Documents/mysql.sock' (2)
xxxxx@MacBook-Pro-3 ~ % mysql -u root
mysql: [Warning] World-writable config file '/etc/my.cnf' is ignored.
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/Users/chengpeng/Documents/mysql.sock' (2)
chengpeng@MacBook-Pro-3 ~ %


macos 13
试了办法
brew remove mysql
brew cleanup
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
sudo rm -rf /usr/local/var/mysql

brew install mysql
mysqld --initialize --explicit_defaults_for_timestamp
mysql.server start # no sudo!
1864 次点击
所在节点    程序员
22 条回复
wu67
2023-02-15 16:03:00 +08:00
mac 配数据库建议 docker. 没这么多奇奇怪怪的问题.
silverdog
2023-02-15 16:09:32 +08:00
xxx@MacBook-Pro-3 ~ % sudo mysql_secure_installation
mysql_secure_installation: [Warning] World-writable config file '/etc/my.cnf' is ignored.

Securing the MySQL server deployment.

Enter password for user root:
Error: Can't connect to local MySQL server through socket '/Users/xxxxx/Documents/mysql.sock' (2)
xxxxx@MacBook-Pro-3 ~ %
julyclyde
2023-02-15 17:26:57 +08:00
Can't connect to local MySQL server through socket '/Users/xxxxx/Documents/mysql.sock'
客户端的某个神奇的配置文件说让它去连接这个根本不存在的地址

而服务器并没有监听在这个地址
kongkx
2023-02-15 17:28:23 +08:00
卸载,清理配置文件,重新安装
silverdog
2023-02-15 17:30:35 +08:00
@julyclyde brew 又启动不了了
lululau
2023-02-15 17:30:37 +08:00
lnav /usr/local/var/mysql/*.err
silverdog
2023-02-15 17:30:55 +08:00
@kongkx 卸载过无数次,重启过无数次,方法都用过
Boos
2023-02-15 17:32:38 +08:00
真难啊
Maboroshii
2023-02-15 17:34:59 +08:00
还是虚拟机 docker 吧,一劳永逸。
liuhuansir
2023-02-15 18:05:27 +08:00
有了 docker 之后,我的笔记本干净多了,再也不需要折腾这些乱七八糟的事了
lusi1990
2023-02-15 18:15:48 +08:00
我用这个命令启动:
brew services start mysql
关闭:
brew services stop mysql
liuzhaowei55
2023-02-15 18:17:41 +08:00
DBngin 特别好用{这条回复会花费我 26 铜币}
littlewing
2023-02-15 18:55:09 +08:00
你是不是以前装过 mysql 5.7 ?
Nazz
2023-02-15 22:32:14 +08:00
我 mac 上的 mysql 最近也挂了,然后换成了 mysql-community-server.dmg
toaruScar
2023-02-15 22:49:55 +08:00
mysql: [Warning] World-writable config file '/etc/my.cnf' is ignored.
权限太宽了吧?
jackytang520
2023-02-16 08:37:24 +08:00
percona server 目前正常使用中
vincent441
2023-02-16 09:04:34 +08:00
有 docker 启动 mysql 吧
renjunv
2023-02-16 09:11:51 +08:00
和楼主同样的问题,各种卸载重装也都试过,目前还没解决
装过 mysql5.7 、8+,可能是升级版本后就开始启动不正常了
brew services run mysql 启动报错,重启电脑 brew 自动启动 mysql 可以成功
renjunv
2023-02-16 09:12:42 +08:00
出现这个问题的时候我的机器是 macos 12
julyclyde
2023-02-16 10:20:23 +08:00
@intkilow 并没有“又”
你那个从来就启动不了

你先搞明白 mysql 的配置文件咋回事再说 brew 的事

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/916371

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX