mysql忘记root密码怎么处理
发表于:2025-11-07 作者:千家信息网编辑
千家信息网最后更新 2025年11月07日,下面一起来了解下mysql忘记root密码怎么处理,相信大家看完肯定会受益匪浅,文字在精不在多,希望mysql忘记root密码怎么处理这篇短内容是你想要的。mysql忘记了超级用户管理密码,可以利用重
千家信息网最后更新 2025年11月07日mysql忘记root密码怎么处理
下面一起来了解下mysql忘记root密码怎么处理,相信大家看完肯定会受益匪浅,文字在精不在多,希望mysql忘记root密码怎么处理这篇短内容是你想要的。
mysql忘记了超级用户管理密码,可以利用重新启动mysql进程的时候带 --skip-grant-tables参数来启动数据库,并空密码登录。这个就是相当于是数据库第一次启动的时候。随后可以查看mysql.user表里面的超级用户,以及修改超级用户的密码
1# 关闭MYSQL instance,或者杀死进程
2# 重新启动mysql,带--skip-grant-tables语句
[mysql@mysql01 my.cnf.d]$ mysqld_safe --defaults-file='/data/mysqldata/3306/my.cnf' --skip-grant-tables &[1] 32530[mysql@mysql01 my.cnf.d]$ 180828 19:02:13 mysqld_safe Logging to '/data/mysqldata/3306/data/../mysql-error.log'.180828 19:02:13 mysqld_safe Starting mysqld daemon with databases from /data/mysqldata/3306/data[mysql@mysql01 my.cnf.d]$ 3# 空密码登录MySQL
[mysql@mysql01 my.cnf.d]$ msyql -S /data/mysqldata/3306/mysql.sock bash: msyql: command not found...[mysql@mysql01 my.cnf.d]$ mysql -S /data/mysqldata/3306/mysql.sock Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 1Server version: 5.6.31-log Source distributionCopyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.(root@localhost)[(none)]> 4# 修改mysql.user表
(root@localhost)[(none)]> use mysql;Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changed(root@localhost)[mysql]> (root@localhost)[mysql]> select user,host,password from user;+------+-----------+-------------------------------------------+| user | host | password |+------+-----------+-------------------------------------------+| root | localhost | *A0F874BC7F54EE086FCE60A37CE7887D8B31086B |+------+-----------+-------------------------------------------+1 row in set (0.00 sec)(root@localhost)[mysql]> update user set password=password('password123') where user='root';Query OK, 0 rows affected (0.00 sec)Rows matched: 1 Changed: 0 Warnings: 0(root@localhost)[mysql]> 5# 正常关闭数据库
[mysql@mysql01 my.cnf.d]$ mysqladmin -S /data/mysqldata/3306/mysql.sock -uroot -p'password123' shutdownWarning: Using a password on the command line interface can be insecure.180828 19:04:54 mysqld_safe mysqld from pid file /data/mysqldata/3306/mysql.pid ended[1]+ Done mysqld_safe --defaults-file='/data/mysqldata/3306/my.cnf' --skip-grant-tables[mysql@mysql01 my.cnf.d]$ 6# 正常开启数据库
[mysql@mysql01 my.cnf.d]$ mysqld_safe --defaults-file='/data/mysqldata/3306/my.cnf' &[1] 33094[mysql@mysql01 my.cnf.d]$ 180828 19:05:04 mysqld_safe Logging to '/data/mysqldata/3306/data/../mysql-error.log'.180828 19:05:04 mysqld_safe Starting mysqld daemon with databases from /data/mysqldata/3306/data[mysql@mysql01 my.cnf.d]$7# 正常登录数据库
[mysql@mysql01 my.cnf.d]$ mysql -uroot -S '/data/mysqldata/3306/mysql.sock' -p'password123'Warning: Using a password on the command line interface can be insecure.Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 1Server version: 5.6.31-log Source distributionCopyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.(root@localhost)[(none)]> 至此mysql的root密码修改完成
看完mysql忘记root密码怎么处理这篇文章后,很多读者朋友肯定会想要了解更多的相关内容,如需获取更多的行业信息,可以关注我们的行业资讯栏目。
密码
数据
数据库
处理
用户
登录
内容
时候
更多
行业
进程
肯定
受益匪浅
信息
参数
就是
文字
朋友
栏目
第一次
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
ibm软件开发工程师认证
从严治警网络安全宣传周
上海鸿企网络技术有限公司
企帮网络技术
log4j2写入数据库性能
多桌面的软件开发
河南那个大专软件开发好
数据库主键代码是什么
中国软件开发者大会地址
安溪县凤城浩川网络技术
青岛软件开发培训机构
数据库系统如何去运营管理
深圳百鸽互联网科技公司
计算机网络技术好考建筑主项吗
将网络技术应用于
对于网络安全的初步认识
网络安全考试大纲
mc怎么建服务器地址
吉林推广软件开发方案
软件开发项目管理属于领导吗
ibm软件开发工程师认证
远程桌面网关服务器
软件开发工程师需具备的素质
萝岗可靠的服务器运维服务
柬埔寨雪川网络技术
有哪些最新数据库网页
长宁区工商数据库系统销售要求
xp支持多少数据库
苍南网络安全案件
安装中间件提示服务器发生异常