navicat 连接mysql 弹出1045 access denied for user 'root'@'密码'(using password :yes)
navicat 连接mysql 弹出1045 access denied for user 'root'@'IP地址'(using password :yes)
这是因为自己本地开发环境电脑的IP地址,并没有赋予访问服务器端mysql数据库的权限
解决办法
1.在mysq中运行下面命令:
use mysql; create user 'root'@'IP地址' identified by '密码'; update user set Password ="密码" where Host="IP地址" and User="root"; grant all privileges on *.* to root@'IP地址';
2.查看数据库mysql中user表中Host字段为‘IP地址’的这一行的密码
use mysql; select Host,Password from user where Host="IP地址"
结果如下
+--------------+------+-------------------------------------------+ | Host | User | Password | +--------------+------+-------------------------------------------+ | IP地址 | root | 密码 | +--------------+------+-------------------------------------------+
3.再次用navicat练级数据库即可