检查是否打开
mysql -h [ip address] -u root -p
打开/usr/local/etc/my.cnf, 修改bind-address = 0.0.0.0
sudo vim /usr/local/etc/my.cnf
restart mysql service
brew services restart mysql@5.7
把用户权限分配各远程用户, MySQL默认root账户不带%而是127.0.0.1,因此需要修改。
mysql -u root -p
use mysql;
update user set host = '%' where user = 'root';
restart mysql service
验证
telnet [ip address] 3306