brew 安装的mysql 如何和Navicat结合

安装mysql时,看了一些博客,建议使用brew安装,看似简单。。。

brew install mysql
//安装成功后运行设置mysql命令
mysql_secure_installation

我遇到下面这个错误是没有重启影响的,如果重启还有这个错,需要看其他解决方案了

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock'

安装完成后,重启

✘ zhanghegang@zhanghegangdeMacBook-Pro  ~  mysql_secure_installation

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?

Press y|Y for Yes, any other key for No: No//是否设置密码等级和位数限制,y必须8位以上
Please set the password for root here.

New password:

Re-enter new password:
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y//是否移除之前的密码
Success.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n//是否不连接远程仓库

 ... skipping.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y //移除测试仓库和之前认证
 - Dropping test database...
Success.

 - Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y//是否现在加载设置
Success.

All done!

在navicat创建mysql链接时,会报一个错误

 2059 - Authentication plugin 'caching_sha2_password' cannot be loaded: dlopen(../Frameworks/cach...

应该是必现,通过.dmp安装的有好多博客介绍,都是可行的,但是brew安装的没有可视化的mysql操作,想要链接成功,就要和可视化的mysql做同样的操作,就是修改密码或者更新密码

  • 重新启动
zhanghegang@zhanghegangdeMacBook-Pro  /usr/local/Cellar/mysql/8.0.12/bin  mysql.server status
 SUCCESS! MySQL running (47763)
 zhanghegang@zhanghegangdeMacBook-Pro  /usr/local/Cellar/mysql/8.0.12/bin  mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 20
Server version: 8.0.12 Homebrew
  • 更新密码并刷新权限
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '刚才设置的密码' PASSWORD EXPIRE NEVER;
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements(当时你设置密码的级别,0,1,2,我这没有按照当时设置的,出现了错误)
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '刚才设置的密码' PASSWORD EXPIRE NEVER;
Query OK, 0 rows affected (0.09 sec)

mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '刚才设置的密码';
Query OK, 0 rows affected (0.06 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
  • 添加身份
mysql> alter user 'root'@'localhost' identified by '刚才设置的密码';
Query OK, 0 rows affected (0.10 sec)

mysql>

最后重连navicat,成功了


brew 安装的mysql 如何和Navicat结合_第1张图片
navicat.png

你可能感兴趣的:(brew 安装的mysql 如何和Navicat结合)