linux登录提示:Access denied for user ‘root‘@‘localhost‘ (using password: YES)解决
linux登录提示:Access denied for user 'root'@'localhost' (using password: YES)解决
·
1.编辑文件:/etc/my.cnf
添加行:skip-grant-tables
如图:
2.重启mysql服务
关闭mysql:service mysqld stop
启动mysql:service mysqld start
如果启动命令不行,用这个:systemctl start mysqld
3.无密码登录mysql
命令:mysql -u root
4.切换数据库
命令:use mysql;
5.更新权限
//123456 是你新设置的密码
命令:update mysql.user set authentication_string=password('123456') where user='root' and host='localhost';
6.重启mysql(步骤2)后再登录尝试
更多推荐
已为社区贡献1条内容
所有评论(0)