CentOS navicat 连接mysql时报错1045

问题描述:

1045-Access denied for user 'root'@'localhost'(using password: YES)

方法:

操作系统为CentOS系列

注意:一定要重启mysql服务或者重启服务器

1、针对一对一用户

# mysql -uroot -p
MySQL [(none)]> grant all privileges on db_name.* to db_user@’%’ identified by ‘db_pass’; #授权语句,特别注意有分号
MySQL [(none)]> flush privileges;
MySQL [(none)]> exit; #退出数据库控制台,特别注意有分号

重启MYSQL:service mysqld restart

2、针对总帐号root  即一个帐号管理所有数据库

grant all privileges on * to root@’%’ identified by ‘dsfdfggdg41;

引用:https://oneinstack.com/docs/lnmpstack-image-guide/ 

如何配置MySQL远程连接  >> 3. 数据库授权

猜你喜欢

转载自blog.csdn.net/haibo0668/article/details/82916298