MySQL 8.0出现 Access denied for user 'root'@'localhost' ;忘记密码的解决方法;跳过权限检查
2019-03-24 23:57
1146 查看
1.管理员权限运行cmd
2.停止MySQL服务
命令行输入net stop mysql
3.跳过权限检查
现在mysqld -skip-grant-tables命令在8.0中没有用了!!!(我之前试了很多遍这个命令,包括在my.ini添加和在命令行中运行,试到崩溃……)
改为使用mysqld --console --skip-grant-tables --shared-memory
4.无密码登陆
另开一个管理员运行的cmd,使用mysql -u root -p命令,出现“enter password:”时直接按回车键,实现无密码登陆
5.改密码
mysql8.0之前更改root密码,输入update user set password=password('123456') where user='root' and host='localhost';因为mysql8.0之前密码字段是"password";
现在的字段是"authentication_string",所以改密码方式也有所变化
使用命令 ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY ‘你的密码’;
但是出现错误“The MySQL server is running with the –skip-grant-tables option so it cannot execute this statement”,具体原因应该是–skip-grant-tables在命令行的时候,使得数据库只能是只读的权限。
使用命令:mysql> flush privileges;
再使用一次改密码命令即可
相关文章推荐
- Mac使用mysql中出现ERROR 1045: Access denied for user: 'root@localhost' 以及密码过期解决方法
- Mac使用mysql中出现ERROR 1045: Access denied for user: 'root@localhost' 以及密码过期解决方法
- 苹果 Mac下 mysql忘记密码解决方法Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'
- Mac使用mysql中出现ERROR 1045: Access denied for user: 'root@localhost' 以及密码过期解决方法
- MySQL无法登录问题-"ERROR 1045 (28000): Access denied for user 'root'@'localhost'"-之解决方法-密码重置
- Mysql初次启动修改root账户密码的方法(解决Access denied for user ''@'localhost' to database 'mysql的方法)
- 登陆MySQL出现error:‘Access denied for user 'root'@localhost (using password :YES)'解决方法
- mysql出现ERROR1698(28000):Access denied for user root@localhost错误解决方法
- win10下MySQL 8.0登录Access denied for user‘root’@‘localhost’ (using password: YES)问题的解决方法
- mysql update完root用户密码后,再登陆报错”Access denied for user 'root'@'localhost' (using password: YES)“的解决方法
- Linux下连接Mysql出现:Access denied for user 'root'@'localhost' (using password:YES)的解决方法
- mysql忘记密码了1045,解决MySql 数据库 提示:1045 access denied for user 'root'@'localhost' using password yes
- linux mysql忘记密码的多种解决或Access denied for user 'root'@'localhost'
- mysql Access denied for user root@localhost错误解决方法
- mysql 出现 1045 access denied for user 'root'@'localhost' using password yes 解决办法
- mysql Access denied for user root@localhost错误解决方法总结
- Mysql Access denied for user root@localhost错误解决方法总结
- 关于远程访问mysql出现Access denied for user 'root'@'的解决方法
- mysql Access denied for user root@localhost错误解决方法总结(转)
- mySQL 5.7版 解决密码登录失败Access denied for user 'root'@'localhost' (using password: NO)