Navicat 连接 Mysql报错 “1045 - Access denied”

步骤:在 mysql 官网下了 macOS 的 dmg 安装包,无脑下一步,完成安装。navicat 用的是网上搜到的 15 版本。启动 mysql 之后,用 navicat 连接,报错1045 - Access denied for user 'root'@'localhost' (using password: YES)

经排查是权限的问题,使用命令

1
2
GRANT ALL PRIVILEGES ON *.* TO'root'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
flush privileges;

报错: ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'identified by 'mypassword' with grant option' at line 1

最后采用直接修改 mysql 字段

use mysql; select host,user from user; update user set host='%' where user='root';

重启 mysql 服务,在“系统偏好设置”->“网络”->“高级”里面查看 ip 地址,将 navicat 的主机改成这个 ip 地址,就 OK 啦

Donate
  • Copyright: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.
  • Copyrights © 2018-2020 Jee
  • Visitors: | Views:

如果您觉得此文章帮助到了您,请作者喝杯咖啡吧~

支付宝
微信