MYSQL5.7忘记root密码
2017-07-14 21:12
495 查看
mysql5.7版本
1、关闭mysql(注:关闭有多种方式,此处是已经注册为服务的情况);
2、启动mysql服务的时候跳过权限认证表;
3、进入mysql数据库;
上面的主要操作,先是进入mysql。enter后提示输入密码,此处不用管直接enter进入,然后选择mysql数据库,再执行更新密码语句,上面第一句update更新报错是因为sql写错了,更新后就执行flush privileges刷新权限,最后退出,再重启mysql,到此,大功告成!
1、关闭mysql(注:关闭有多种方式,此处是已经注册为服务的情况);
[root@iZ8vbjfnjgynrnv1qfpuw1Z /]# service mysql stop
2、启动mysql服务的时候跳过权限认证表;
[root@iZ8vbjfnjgynrnv1qfpuw1Z /]# mysqld_safe --skip-grant-tables &
3、进入mysql数据库;
[root@iZ8vbjfnjgynrnv1qfpuw1Z /]# mysql -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.7.18-log Source distribution Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> use mysql; Database changed mysql> update user set password=password('root') where usr='root'; ERROR 1054 (42S22): Unknown column 'usr' in 'where clause' mysql> update mysql.user set authentication_string=password('123456') where user='root' and Host ='localhost'; Query OK, 1 row affected, 1 warning (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 1 mysql> flush privileges; Query OK, 0 rows affected (0.01 sec) mysql> exit; Bye [root@iZ8vbjfnjgynrnv1qfpuw1Z /]# service mysql start Starting MySQL SUCCESS!
上面的主要操作,先是进入mysql。enter后提示输入密码,此处不用管直接enter进入,然后选择mysql数据库,再执行更新密码语句,上面第一句update更新报错是因为sql写错了,更新后就执行flush privileges刷新权限,最后退出,再重启mysql,到此,大功告成!
相关文章推荐
- Mysql5.7忘记root密码及mysql5.7修改root密码的方法
- Mysql5.7忘记root密码及mysql5.7修改root密码的方法
- Mysql5.7忘记root密码及修改root密码的方法
- CentOS7下mysql5.7忘记root密码的处理方法
- Mysql5.7忘记root密码怎么办(简单且有效方法)
- [置顶] windows下mysql5.7忘记root密码后的解决方法
- Windows下Mysql5.7忘记root密码的解决方法
- CentOS7下mysql5.7忘记root密码的处理方法
- Mysql5.7忘记root密码及mysql5.7修改root密码的方法
- linux忘记mysql5.7的root用户密码
- mysql5.7忘记密码时,修改root密码
- centos7 mysql5.7忘记root密码
- Mysql5.7忘记root密码怎么办(简单且有效方法)
- mysql5.7忘记密码时,修改root密码
- Mysql5.7忘记root密码及mysql5.7修改root密码的方法
- mysql5.7忘记root密码
- Mac下MySQL5.7忘记root密码的解决方法
- Mysql5.7忘记root密码及mysql5.7修改root密码的方法
- centos7 yum安装mysql5.7并在root密码忘记的情况下重设密码
- Mysql5.7忘记root密码及mysql5.7修改root密码的方法