2,修改端口号
查看/Library/LaunchDaemons下的com.oracle.oss.mysql.mysqld.plist发现根本就没有Port相关的配置
于是尝试解决;
2.1,停止MySQL服务
sudo /usr/local/mysql/support-files/mysql.server stop
输入本机密码即可
2.2,在com.oracle.oss.mysql.mysqld.plist文件中的ProgramArguments下添加<string>--port=3306</string>保存退出
<key>ProgramArguments</key>
<array>
<string>/usr/local/mysql/bin/mysqld</string>
<string>--user=_mysql</string>
<string>--basedir=/usr/local/mysql</string>
<string>--datadir=/usr/local/mysql/data</string>
<string>--plugin-dir=/usr/local/mysql/lib/plugin</string>
<string>--log-error=/usr/local/mysql/data/mysqld.local.err</string>
<string>--pid-file=/usr/local/mysql/data/mysqld.local.pid</string>
<string>--keyring-file-data=/usr/local/mysql/keyring/keyring</string>
<string>--early-plugin-load=keyring_file=keyring_file.so</string>
<string>--port=3306</string>
</array>
重启MySQL数据库,再次查看MySQL端口,变为了 3306
重新连接数据库,成功!
启动MySQL服务
sudo /usr/local/MySQL/support-files/mysql.server start
停止MySQL服务
sudo /usr/local/mysql/support-files/mysql.server stop
重启MySQL服务
sudo /usr/local/mysql/support-files/mysql.server restart