Navicat连接服务器弹出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练级数据库即可。

转载自:https://www.cnblogs.com/lizhihui/articles/5490217.html

**

方法二:

**

1、SSH登录root管理员账户

2、登录MySql

# mysql -u root -p
Enter password: 

(3)执行授权命令

mysql> grant all privileges on *.* to root@'localhost' identified by '密码';
mysql> flush privileges;

mysql> grant all privileges on *.* to root@'%' identified by '密码';
mysql> flush privileges;

(4)退出再试

mysql> quit
Bye

原文链接:https://blog.csdn.net/lhl1124281072/article/details/80277163

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值