当前位置:首页 > 主播热点 > mysql重置密码怎么操作(如何找回mysql数据库的连接密码)

mysql重置密码怎么操作(如何找回mysql数据库的连接密码)

更新时间:2023-03-18 10:30:06浏览次数:116+次

1. 前言This article mainly explains two ways to deal with the password forgetting of the root account of relational database. After testing, it can effectively solve the password reset problem of relational database

mysql重置密码怎么操作(如何找回mysql数据库的连接密码) MySQL-password-reset-01.png2. 重置mysql root用户方法1:Step1.停止MySQL服务[root @ zcwyou ~] # kill`cat/var/run/mysqld/Mysqld. PID' or [root @ zcwyou ~] # pkill mysqldStep2.创建一个密码赋值语句的文本文件[root @ zcwyou ~] # vimysql-init alter user' root'@'localhost' by' MyNewPass! 6' Reset the password before loading the authorization table.Step3.使用—init-file选项启动MySQL服务

[root @ zcwyou ~]# mysqld-init-file=MySQL-init-user=MySQLStep4.删除文本文件,使用新密码连接MySQL[root @ zcwyou ~]# RM-f MySQL-init[root @ zcwyou ~]# MySQL-uroot-p ' my new pass!6 'Step5.停止MySQL服务并正常启动[root @ zcwyou ~]# kill ` cat/var/run/mysqld/mysqld . PID `[ root @ zcwyou ~]# system CTL start mysqld

mysql重置密码怎么操作(如何找回mysql数据库的连接密码) MySQL-password-reset-02 . png2. 修改mysql root用户密码之方法2Step1.停止MySQL服务[root @ zcwyou ~]# kill ` cat/var/run/mysqld/mysqld . PID ` 1或者[root @ zcwyou ~]# pkill mysqld

mysql重置密码怎么操作(如何找回mysql数据库的连接密码) MySQL-password-reset-03 . jpgStep2: 启动mysql时,跳过某些选项

Use the-skip-authorization-table-skip-network option to start the relational database service [root @ zcwyou ~]# Mysqld-skip-grant-tables-skip-networking-user=MySQL-skip-grant-tables: Skip authorization table authentication-Skip network: After adding the skip authorization table option, everyone can log in without a password, which is very unsafe. This option does not monitor the network to prevent malicious login.Step3:无密码连接MySQL[root @ zcw] Mysql ALTER user "root" @ "localhost" is created by "MyNewPass! 6'

5.停止MySQL服务并正常启动[root @ zcwyou ~]# kill ` cat/var/run/mysqld/mysqld . PID `[root @ zcwyou ~]# systemctlstartmysqldStep4:破解mysql密码MySQL密码要小心保管。一般情况下,密码不应该重置,应该准备好输入。但是Mysql密码破解技巧应该是每个系统运维工程师必备的技能之一。重置连接mysql数据库的密码。