数据库密码忘记?
步骤1 启用一下数据
vi my.cnf 启用一下数据
#[mysqld]
#skip-grant-tables
步骤2 重启数据库
systemctl stop mysqld.service
systemctl start mysqld.service
步骤三 登录数据库,密码直接跳过回车
mysql -u root -p
use mysql;
flush privileges;
select user,plugin from user where user='root';
select user,host from user; ####################选择 host 为%的用户
alter user 'root'@'%' identified with mysql_native_password by 'your password';
步骤四 重启数据库
systemctl stop mysqld.service
systemctl start mysqld.service
本文详细介绍了在忘记MySQL数据库密码时,通过启用数据、跳过密码登录、修改权限及重启服务四个步骤来重置的完整过程。
1141

被折叠的 条评论
为什么被折叠?



