破解並重設mysql密碼

來源:互聯網
上載者:User

標籤:mysql   破解密碼   

-破解並重設mysql密碼

密碼這東西,總有忘記的時候,或者是一下子沒有記錄下來,或者是上一手交接的時候根本沒人跟你說,或者是老舊到連老領導也忘記的資料庫,問題是該用還是得用,那就把它破解了唄。

#先關閉mysqlservice mysqld stop#進入安全模式,可以免密碼登入/usr/local/mysql/bin/mysqld_safe --skip-grant-tables --skip-networking&#免密碼登陸/usr/local/mysql/bin/mysql -uroot#更改密碼,密碼和使用者可選,自己選擇要更新到什麼使用者環境update mysql.user set password=PASSWORD(‘新密碼‘) where user=‘root‘ and host=‘root‘ or host=‘localhost‘or host=‘localhost.localdomain‘or host=‘127.0.0.1‘;#在5.7之後要用新的欄位update mysql.user set authentication_string=password(‘新密碼‘) where user=‘root‘;#重新整理策略flush privileges;#重啟mysql/etc/init.d/mysqld restart#正常登陸/usr/local/services/mysql/bin/mysql -uroot  -p‘新密碼‘#測試功能是否正常mysql> show databases;

其實也算簡單,不過請記住不要影響現有資料。



破解並重設mysql密碼

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.