溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Mysql密碼重置方法介紹

發布時間:2020-05-19 14:01:45 來源:網絡 閱讀:246 作者:三月 欄目:MySQL數據庫

本文主要給大家介紹Mysql密碼重置方法,文章內容都是筆者用心摘選和編輯的,具有一定的針對性,對大家的參考意義還是比較大的,下面跟筆者一起了解下Mysql密碼重置方法吧。 

  • Step # 1: Stop the MySQL server process.
  • Step # 2: Start the MySQL (mysqld) server/daemon process with the –skip-grant-tables option so that it will not prompt for password.
  • Step # 3: Connect to mysql server as the root user.
  • Step # 4: Setup new mysql root account password i.e. reset mysql password.
  • Step # 5: Exit and restart the MySQL server.

ok,五步,開始!

Step # 1 : 停止sql服務

/etc/init.d/mysql stop

輸出 Stopping MySQL database server: mysqld.

Step # 2: 啟動mysql服務鏡像

mysqld_safe --skip-grant-tables &

輸出
Starting mysqld daemon with databases from /var/lib/mysql
mysqld_safe

Step # 3: 以mysql服務的方式去鏈接數據庫

mysql -u root

輸出顯示
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.15-Debian_1-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>

Step # 4: 為root用戶設置新的密碼

mysql> use mysql;
mysql> update user set password=PASSWORD("你的密碼") where User='root';
mysql> flush privileges;
mysql> quit

Step # 5: 啟動mysql服務

/etc/init.d/mysql stop

Stopping MySQL database server: mysqld
STOPPING server from pid file /var/run/mysqld/mysqld.pid
mysqld_safe[6186]: ended
[1]+  Done                    mysqld_safe --skip-grant-tables</pre>

Step # 6: 驗證

 /etc/init.d/mysql start
 mysql -u root -p

輸入這條命令按enter鍵后再輸入密碼,就能進去數據庫啦!

reference:
https://www.cyberciti.biz/tips/recover-mysql-root-password.html

看完以上關于Mysql密碼重置方法,很多讀者朋友肯定多少有一定的了解,如需獲取更多的行業知識信息 ,可以持續關注我們的行業資訊欄目的。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女