当前位置: 首页 > news >正文

MYSQL 5.7重置root密码

Mysql 5.7重置root密码

  • 如果您忘记了MySQL 5.7的root密码,可以通过以下步骤重置:
    停止MySQL服务。在命令行中输入以下命令:
systemctl stop mysqld
  • 启动MySQL服务并跳过授权表。在命令行中输入以下命令:
mysqld_safe --skip-grant-tables &
  • 以root用户登录MySQL。在命令行中输入以下命令:
mysql
  • 选择mysql数据库。输入以下命令:
use mysql;
  • 重置root密码。将your_new_password替换为您想要设置的新密码,然后输入以下命令:
update user set authentication_string=PASSWORD('your_new_password') where User='root';
  • 刷新权限。输入以下命令:
flush privileges;
  • 退出MySQL。输入以下命令:
quit;
  • 停止MySQL服务。在命令行中输入以下命令:
systemctl stop mysqld
  • 重新启动MySQL服务。在命令行中输入以下命令:
systemctl start mysqld
  • 现在已经成功重置了MySQL 5.7的root密码,能正常登录mysql了。
[root@test mysql]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.38-log MySQL Community Server (GPL)Copyright (c) 2000, 2022, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
http://www.lryc.cn/news/337929.html

相关文章:

  • 博客永久链接与计数
  • 基于 RisingWave 和 ScyllaDB 构建事件驱动应用
  • mysql8.0高可用集群架构实战
  • GRE/MGRE详解
  • 蓝桥杯(填空题)
  • vim快捷指令
  • LINUX 下IPTABLES配置详解
  • CentOS 网卡ifcfg-eth0 ping不通外网(www.baidu.com)
  • 【C++】类和对象②(类的默认成员函数:构造函数 | 析构函数)
  • 【ZZULIOJ】1063: 最大公约与最小公倍(Java)
  • 遍历列举俄罗斯方块的所有形状
  • 将Visio绘图导出PDF文件,使其自适应大小,并去掉导入Latex的边框显示
  • android支付宝接入流程
  • Mac 下 Python+Selenium 自动上传西瓜视频
  • 六:ReentrantLock —— 可重入锁
  • 一种驱动器的功能安全架构介绍
  • 紫光展锐T610平台_4G安卓核心板方案定制开发
  • C++11 设计模式4. 抽象工厂(Abstract Factory)模式
  • 第8周 Python面向对象编程刷题
  • 【学习心得】神经网络知识中的符号解释②
  • Igh related:Small Bug And Notes Record.
  • 【QT入门】Qt自定义控件与样式设计之qss介绍(Qt style sheet)
  • [ LeetCode ] 题刷刷(Python)-第49题:字母异位词分组
  • 冒泡排序算法实现步骤
  • js实现webp转png/jpg
  • DVWA -File Upload-通关教程-完结
  • 中介者模式:简化对象间通信的协调者
  • 【Python系列】pydantic版本问题
  • 深度学习-多尺度训练的介绍与应用
  • 详解单文件组件