標籤:tables password 查看 ror run int emctl war iad
Linux MariaDB 遺忘密碼後重設密碼
MariaDB 是 MySQL 的一個分支資料庫。處理的辦法和 MySQL 相同。
修改 MySQL 設定檔
在 [mysqld] 追加配置項:
[[email protected] ~]# vim /etc/my.cnf[[email protected] ~]# cat /etc/my.cnf...[mysqld]skip-grant-tables...
重啟相關服務
該樣本使用的是 MariaDB,重啟該服務並查看是否啟動成功:
[root@node9 ~]# systemctl restart mariadb[root@node9 ~]# systemctl status mariadb
登陸資料庫修改密碼
[root@node9 ~]# mysql -uroot -pMariaDB [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
這邊需要注意 password 必須需要寫進來,否則修改不完全,報錯資訊如下:
[[email protected] ~]# mysql -uroot -pMariaDB [mysql]> UPDATE user SET Password = ‘48eb1c1c770d4bbc‘ WHERE User = ‘root‘ ;Query OK, 4 rows affected (0.00 sec)Rows matched: 4 Changed: 4 Warnings: 0...[[email protected] ~]# mysql -uroot -pEnter 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 遺忘密碼後重設密碼