百恒网络
root密码过期的解决办法
  • 百恒服务
  • APP开发
  • 网页案例
  • 网页知识
  • 关于我们
  • 联系我们
  • root密码过期的解决办法

    2023-02-23 16:23:16 1113
           root也称为根用户,中文名叫超级用户权限,是用来完全掌控系统底层及系统文件的,在使用的过程中碰到root密码过期也是很正常的,下面南昌网络公司小编来跟大家聊一下root密码过期的解决办法。


    root密码过期的解决办法


           mysql 5.7.14安装完后登陆报错,意思是密码过期

           [root@mysql]# mysql -u root -p
           Enter password: 
           ERROR 1862 (HY000): Your password has expired. To log in you must change it using a client that supports expired passwords.

           解决办法:

           1、在my.cnf  mysqld 部分加入 skip-grant-tables 参数。

           [mysqld]
           skip-grant-tables

           2、重启mysql数据库,然后登陆

           [root@llmj-mysql-40-115 tools]# mysql -u root -p
           Enter password:   #这里直接回车,不需要密码即可登陆
           Welcome to the MySQL monitor.  Commands end with ; or g.
           Your MySQL connection id is 2
           Server version: 5.7.14-log MySQL Community Server (GPL)
           Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.=
           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.

           3、查看mysql的用户状态

           >select host,user,password_expired,account_locked from mysql.user;
           +-----------+-----------+------------------+----------------+
           | host      | user      | password_expired | account_locked |
           +-----------+-----------+------------------+----------------+
           | localhost | root      | Y                | N              |
           | localhost | mysql.sys | N                | Y              |
           +-----------+-----------+------------------+----------------+
           3 rows in set (0.00 sec)

           password_expired :y说明密码已经过期,可以改成N,则是未过期

           >update mysql.user set password_expired='N';
           Query OK, 1 row affected (0.03 sec)
           Rows matched: 2  Changed: 1  Warnings: 0

           4、然后注释掉skip-grant-tables参数

           重启mysql,用过期的密码即可登陆了,登陆之后可以用下面的命令修改密码
           >alter user user() identified by '123456';
           Query OK, 0 rows affected (0.03 sec)

           >flush privileges;
           Query OK, 0 rows affected (0.03 sec)

           以上是南昌网络公司百恒科技小编要跟大家聊到的关于root密码过期的解决办法,希望能够对大家有所帮助,想要了解更多关于这方面的内容,欢迎留言咨询百恒科技,百恒科技是一家有着16年丰富经验的网络公司,专注于南昌网站建设开发南昌APP开发等一系列互联网服务!


    相关文章推荐   :    微信公众号如何添加卡券功能?    

                          Linux平台下安装FFmpeg的流程是怎样的?     
    展开分享
    服务
    案例
    首页
    动态
    联系
    咨询