mysql5.7忘记root密码-如何重置了?

1、停止mysql

systemctl stop mysqld

2、启动无权限表的mysql服务:

mysqld_safe --skip-grant-tables &

3、升级过数据库的执行这个步骤

mysql_upgrade -u root

ss -lntup | grep 3306

pid 1647

kill -TERM 1647

4、mysqld_safe --skip-grant-tables &

5、mysql -u root

6、FLUSH PRIVILEGES;

7、SET PASSWORD FOR 'root'@'localhost' = PASSWORD('new_password');

8、ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';

9、EXIT;

10、

复制代码
[root@centos7 ~]# ss -lntup | grep 3306
tcp    LISTEN     0      50        *:3306                  *:*                   users:(("mysqld",pid=1647,fd=14))
[root@centos7 ~]# kill -TERM 1647

11、

复制代码
systemctl start mariadb

12、mysql -uroot -pnew_passwd

相关推荐
黄林晴1 天前
如何判断手机是否是纯血鸿蒙系统
android
火柴就是我1 天前
flutter 之真手势冲突处理
android·flutter
法的空间1 天前
Flutter JsonToDart 支持 JsonSchema
android·flutter·ios
循环不息优化不止1 天前
深入解析安卓 Handle 机制
android
恋猫de小郭1 天前
Android 将强制应用使用主题图标,你怎么看?
android·前端·flutter
jctech1 天前
这才是2025年的插件化!ComboLite 2.0:为Compose开发者带来极致“爽”感
android·开源
用户2018792831671 天前
为何Handler的postDelayed不适合精准定时任务?
android
叽哥1 天前
Kotlin学习第 8 课:Kotlin 进阶特性:简化代码与提升效率
android·java·kotlin
Cui晨1 天前
Android RecyclerView展示List<View> Adapter的数据源使用View
android
氦客1 天前
Android Doze低电耗休眠模式 与 WorkManager
android·suspend·休眠模式·workmanager·doze·低功耗模式·state_doze