当前位置:Gxlcms > 数据库问题 > MySQL数据库应用(4)管理实战(2)-- 找回密码

MySQL数据库应用(4)管理实战(2)-- 找回密码

时间:2021-07-01 10:21:17 帮助过:18人阅读

!

        2)使用--skip-grant-tables启动mysql,忽略授权登录验证

[root@localhost ~]# mysqld_safe --skip-grant-tables --user=mysql &
[1] 1866
[root@localhost ~]# 190919 01:16:35 mysqld_safe Logging to /application/mysql-5.5.32/data/localhost.localdomain.err.
190919 01:16:35 mysqld_safe Starting mysqld daemon with databases from /application/mysql-5.5.32/data

[root@localhost ~]# mysql     < == 登录时空密码

        3)修改root密码为新密码

mysql> update mysql.user set password=password(dubin) where user=root and host=localhost;
Query OK, 1 row affected (0.13 sec)
Rows matched: 1  Changed: 1  Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye

        4)重启服务器再登录

[root@localhost ~]# /etc/init.d/mysqld stop
Shutting down MySQL.190919 01:20:07 mysqld_safe mysqld from pid file /application/mysql-5.5.32/data/localhost.localdomain.pid ended
 SUCCESS! 
[1]+  Done                    mysqld_safe --skip-grant-tables --user=mysql
[root@localhost ~]# /etc/init.d/mysqld start
Starting MySQL.. SUCCESS! 
[root@localhost ~]# mysql -uroot -pdubin
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.32 Source distribution



##这里应该是不能用stop停止的,可能是我用set设置密码的原因
应该是用mysqladmin停止服务
技术图片

     2、多实例MySQL启动修改丢失root密码

        1)关闭mysql

[root@localhost ~]# kill mysqld

 

        2)启动时加 --skip-grant-tables参数

        技术图片

        3)修改密码的方法

                           技术图片

         4)重启服务用新密码登录

                              技术图片

 

   

 

MySQL数据库应用(4)管理实战(2)-- 找回密码

标签:oca   end   bsp   技术   修改密码   密码   ==   serve   sql数据库   

人气教程排行