当前位置:Gxlcms > 数据库问题 > Linux MariaDB 遗忘密码后重置密码

Linux MariaDB 遗忘密码后重置密码

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

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

重启相关服务

该示例使用的是 MariaDB,重启该服务并查看是否启动成功:

[root@node9 ~]# systemctl restart mariadb
[root@node9 ~]# systemctl status mariadb
  • 1
  • 2
  • 1
  • 2

登陆数据库修改密码

[root@node9 ~]# mysql -uroot -p
MariaDB [mysql]> UPDATE user SET Password = password(‘48eb1c1c770d4bbc‘) WHERE User = ‘root‘ ;
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4  Changed: 4  Warnings: 0
  • 1
  • 2
  • 3
  • 4
  • 1
  • 2
  • 3
  • 4

这边需要注意 password 必须需要写进来,否则修改不完全,报错信息如下:

[root@node9 ~]# mysql -uroot -p
MariaDB [mysql]> UPDATE user SET Password = ‘48eb1c1c770d4bbc‘ WHERE User = ‘root‘ ;
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4  Changed: 4  Warnings: 0
...
[root@node9 ~]# mysql -uroot -p
Enter password:
ERROR 1275 (HY000): Server is running in --secure-auth mode, but ‘root‘@‘localhost‘ has a password in the old format; please change the password to the new format
...

Linux MariaDB 遗忘密码后重置密码

标签:tables   password   查看   ror   run   int   emctl   war   iad   

人气教程排行