Ubuntu下MySQL root密碼忘記的解決方法
Linux下忘記MySQL root密碼解決方法,基于Ubuntu 14.04 LTS。
本文是在root用戶下進行操作,其他操作需要對應權限
編輯mysql的配置文件/etc/mysql/my.cnf,在[mysqld]段下加入一行“skip-grant-tables”。
重啟mysql服務
sudo service mysql restart
用空密碼進入mysql管理命令行,切換到mysql庫。
root@DENGJAMESLI:~$ mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
mysql> use mysql
mysql> update user set password=PASSWORD("new_pass") where user='root';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 4 Changed: 0 Warnings: 0
mysql>quit
回到vim /etc/mysql/my.cnf,把剛才加入的那一行“skip-grant-tables”注釋或刪除掉。
再次重啟mysql服務sudo service mysql restart,使用新的密碼登陸,修改成功。
www.linuxidc.com @ubuntu:~$ mysql -u root -p new_pass Welcome to the MySQL monitor. Commands end with ; or \g. mysql>
以上所述是小編給大家介紹的Ubuntu下忘記MySQL root密碼解決方法,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
相關文章
詳解Linux內(nèi)核中的container_of函數(shù)
大家都知道Container_of在Linux內(nèi)核中是一個常用的宏,用于從包含在某個結構中的指針獲得結構本身的指針,通俗地講就是通過結構體變量中某個成員的首地址進而獲得整個結構體變量的首地址。這篇文章詳細的介紹了Container_of,有需要的可以參考學習。2016-08-08
mac 系統(tǒng)下使用 chmod 命令修改文件權限
這篇文章主要介紹了mac 系統(tǒng)下使用 chmod 命令修改文件權限的相關資料,需要的朋友可以參考下2017-10-10

