MySQLのrootパスワードはどのように行うのを忘れ?

1、パスワードなしのログインを実装し、MySQLの設定ファイルを変更します

在mysql配置文件中添加以下参数:
[mysqld]
skip-grant-tables

2、MySQLサービスを再起動します

service mysqld restart

3、無料の秘密の着陸

mysql -uroot -p (直接点击回车,密码为空)

4、rootのパスワードを変更します

1.切换数据库
use mysql;
2.执行命令修改密码
update user set password=password('root') where user='root';
//5.7 以后版本执行上面命令报错可以尝试以下语句:
update user set authentication_string=password('123456') where user='root';
3.刷新权限
flush privileges;
//可能会出现的异常
ERROR 1820 (HY000): You must reset your password using ALTER USER statement;
//解决办法(执行以下命令):
alter user user() identified by "root";

5、MySQLサービスを再起動し、設定ファイルを復元します

[mysqld]
#skip-grant-tables
//重启服务
service mysqld restart

6、新しいパスワードを使用して

mysql -uroot -p (回车输入密码)
リリース元の4件の記事 ウォンの賞賛6 ビュー1760

おすすめ

転載: blog.csdn.net/m0_46422300/article/details/104685630