Linux MariaDB 遺忘密碼後重設密碼

來源:互聯網
上載者:User

標籤: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...
  • 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 -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
  • 1
  • 2
  • 3
  • 4
  • 1
  • 2
  • 3
  • 4

這邊需要注意 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 遺忘密碼後重設密碼

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.