首先关闭正在运行的mysqld进程
- 执行mysqld_safe --skips-grant-tables &
- 双击enter 键进入命令行模式
- 执行 mysql
- linux 系统执行:update mysql.user set password = password(‘root‘) where user = ‘root‘ and host = ‘localhost‘;
- mac 系统执行:update mysql.user set authentication_string=password(‘root‘) where user = ‘root‘ and host = ‘localhost‘;
- 刷新权限:flush privileges;
- 退出:quit
- 杀死mysqld进程,然后重新连接 :mysql -uroot -proot
- 完成
原文地址:https://www.cnblogs.com/china-flint/p/9684902.html
时间: 2024-11-09 09:03:07