From 856eb00e1a827a2ee6395ff797f6f17a7409dbbd Mon Sep 17 00:00:00 2001 From: old-tom <892955278@msn.cn> Date: Thu, 14 Aug 2025 22:28:46 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mysql/mysql8 忘记密码处理步骤.md | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 问题排查/mysql/mysql8 忘记密码处理步骤.md diff --git a/问题排查/mysql/mysql8 忘记密码处理步骤.md b/问题排查/mysql/mysql8 忘记密码处理步骤.md new file mode 100644 index 0000000..2bab013 --- /dev/null +++ b/问题排查/mysql/mysql8 忘记密码处理步骤.md @@ -0,0 +1,21 @@ +1. 停止当前mysqld服务 +`service mysql stop` + +2. 用安全模式启动 +`sudo mysqld_safe --skip-grant-tables--user=mysql&` + +3. 无密码登陆 +`mysql -u root` + +4. 修改密码 +```sql +FLUSH PRIVILEGES; +ALTER USER 'root'@'localhost' IDENTIFIED BY '密码'; +EXIT; +``` + +5. 恢复正常mysql服务 +``` +sudo pkill mysqld +service mysql start +``` \ No newline at end of file