我在macOS High Sierra(10.13.6)上安装了mysql 8.0.12:
UnhandledException
这是我的$ brew info mysql
mysql: stable 8.0.12 (bottled)
Open source relational database management system
https://dev.mysql.com/doc/refman/8.0/en/
Conflicts with:
...
/usr/local/Cellar/mysql/8.0.12 (255 files, 233.0MB) *
Poured from bottle on 2018-09-04 at 11:09:42
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/mysql.rb
==> Dependencies
Build: cmake ✔
Required: openssl ✔
==> Requirements
Required: macOS >= 10.10 ✔
==> Options
...
文件的内容:
my.cnf
问题是当我通过自制软件启动mysql时:
# Default Homebrew MySQL server config
[mysqld]
# Only allow connections from localhost
bind-address = 127.0.0.1
并检查它是否正在运行:
brew services start mysql
我无法使用默认选项连接到$ brew services list
Name Status User Plist
mysql started jhl /Users/jhl/Library/LaunchAgents/homebrew.mxcl.mysql.plist
$ ps aux | grep mysql
jhl 8609 0.0 0.0 4267768 900 s004 S+ 11:21AM 0:00.00 grep mysql
jhl 8364 0.0 2.2 4896156 367368 ?? S 11:18AM 0:00.96 /usr/local/opt/mysql/bin/mysqld --basedir=/usr/local/opt/mysql --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/opt/mysql/lib/plugin --log-error=jhls-MacBook-Pro.local.err --pid-file=jhls-MacBook-Pro.local.pid
jhl 8275 0.0 0.0 4282688 1300 ?? S 11:18AM 0:00.02 /bin/sh /usr/local/opt/mysql/bin/mysqld_safe --datadir=/usr/local/var/mysql
jhl 4558 0.0 0.0 4298668 3352 s000 S+ 11:01AM 0:00.04 view /usr/local/var/mysql/jhls-MacBook-Pro.local.err
$ lsof -i :3306
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld 8364 jhl 19u IPv4 0xb949031a3ab21e7b 0t0 TCP localhost:mysql (LISTEN)
mysqld
我总是必须指定端口:
$ mysql -uroot
ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (61)
这在命令行上可以正常工作,但是在尝试连接到其他数据库工具(例如RubyMine中的数据库窗口)时我并不走运。我已经从自制软件中多次安装了mysql(版本8)和mysql版本5.7(确保每次都执行一次full uninstallation),并且这个问题似乎在我尝试使用的所有版本上仍然存在,这是网络问题。我什至尝试在$ mysql -uroot -P 3306
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.12 Homebrew
...
mysql>
的{{1}}和port
部分中指定[client]
,但是没有运气。