mysql故障--忘記密碼如何找回

來源:互聯網
上載者:User

標籤:mit   user   0.00   local   .com   table   直接   gre   port   

  1. 單一實例下直接停掉資料庫 
  2. 多執行個體情況下殺掉相應執行個體的進程,比如3306 

[[email protected] ~]# ps aux |grep mysql 

root     10384  0.0  0.0 106244  1416 ?        S    18:48   0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --defaults-file=my.cnf 

mysql    11370  0.0 29.8 1061116 567060 ?      Sl   18:48   0:09 /usr/local/mysql/bin/mysqld --defaults-file=my.cnf --basedir=/usr/local/mysql --datadir=/data/mysql/3307/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/3307/mysqld_3307.err --open-files-limit=1024 --pid-file=/data/mysql/3307/mysqld.pid --socket=/data/mysql/3307/mysql.sock --port=3307 

root     12618  0.0  0.0 106248  1472 ?        S    19:27   0:00 /bin/sh /usr/local/mysql/bin//mysqld_safe --defaults-file=/data/mysql/3306/my.cnf 

mysql    14472  0.0  6.5 637228 125068 ?       Sl   21:58   0:03 /usr/local/mysql/bin/mysqld --defaults-file=/data/mysql/3306/my.cnf --basedir=/usr/local/mysql --datadir=/data/mysql/3306/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/3306/mysqld_3306.err --open-files-limit=48 --pid-file=/data/mysql/3306/mysqld.pid --socket=/data/mysql/3306/mysql.sock --port=3306 

root     15038  0.0  0.0 103316   832 pts/1    S+   23:50   0:00 grep mysql 

[[email protected] ~]# kill 14472 

  1. 使用命令重新啟動 

[[email protected] ~]# /usr/local/mysql/bin/mysqld_safe --defaults-file=/data/mysql/3306/my.cnf  --skip-grant-table & 

[[email protected] ~]# mysql -S /data/mysql/3306/mysql.sock  

mysql> UPDATE user SET password=PASSWORD(‘zckj.com‘) WHERE user=‘root‘;  

Query OK, 0 rows affected (0.00 sec) 

 

mysql> FLUSH PRIVILEGES; 

Query OK, 0 rows affected (0.00 sec) 

 

注意:多執行個體下--skip-grant-table參數一定下my.cnf參數後邊啟動 

  1. 正常退出後,重新正常啟動即可,否則還是帶著--skip-grant-table 參數

 

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.