MySQL连接报1045错误

MySQL连接报1045-access denied for user ‘root’@‘xxxxxxx’(using password:yes)

一.

1.编辑/usr/local/mysql/my.cnf

找到[mysqld],在下方添加skip_grant_tables,该语句代表登录mysql时跳过输入密码的操作,忽略登录检查

2.重启mysql服务器

/ect/init.d/mysql restart

3.mysql -u root -p 进入

4.use mysql;

5.UPDATE user SET password=PASSWORD(‘newpasswd’)WHERE user=’root’;

6.flush privileges

7. exit

8.修改my.cnf 删除刚才添加的那一行代码

扫描二维码关注公众号,回复: 9989102 查看本文章

9.重启mysql服务

二.ip权限问题

1.mysql -u root -p 进入mysql

2.执行下面命令

grant all privileges on *.* to 'root'@'自己电脑的ip' identified by 'yky@2020#.';    #给当前ip授权
grant all privileges on *.* to 'root'@'%' identified by 'yky@2020#.';   #给所有ip授权
 

发布了74 篇原创文章 · 获赞 72 · 访问量 7万+

猜你喜欢

转载自blog.csdn.net/weixin_43713498/article/details/104970418