如何在MySQL 8.0.11中重置root密码? [英] How to reset the root password in MySQL 8.0.11?
问题描述
我实际上已经丢失了root密码,需要更改它.我按照以下步骤操作:
I have actually lost my root password and I need to change it. I follow these steps :
-
步骤#1:停止MySQL服务器进程.
Step # 1: Stop the MySQL server process.
步骤2:使用以下命令启动MySQL(mysqld)服务器/守护进程 --skip-grant-tables选项,这样它就不会提示您输入密码.
Step # 2: Start the MySQL (mysqld) server/daemon process with the --skip-grant-tables option so that it will not prompt for a password.
第3步:以root用户身份连接到MySQL服务器.
Step # 3: Connect to the MySQL server as the root user.
:
第一个错误,所以我尝试了: First error, so I tried : 总是说同样的错误: 我该如何解决? 如这里说: 此功能已在MySQL 8.0.11中删除 This function was removed in MySQL 8.0.11 1.如果您处于跳过授予表模式下 1.if you in skip-grant-tables mode 然后在终端: 在mysql中: 2.不在跳过授予表模式下 2.not in skip-grant-tables mode 这篇关于如何在MySQL 8.0.11中重置root密码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!mysql> use mysql;
mysql> update user set password=PASSWORD("TOOR") where User='root';
mysql> flush privileges;
mysql> quit
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '("TOO
R") WHERE User='root'' at line 1
推荐答案
在mysqld_safe中:
in mysqld_safe:UPDATE mysql.user SET authentication_string=null WHERE User='root';
FLUSH PRIVILEGES;
exit;
mysql -u root
ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'yourpasswd';
只是在mysql中:
just in mysql:ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'yourpasswd';