如何重置MySQL(root用戶)密碼
1、首先停止正在運行的MySQL進程
Linux下,運行 killall -TERM mysqld
Windows下,如果寫成服務(wù)的 可以運行:net stop mysql,如未加載為服務(wù),可直接在進程管理器中進行關(guān)閉。宇塵網(wǎng)絡(luò)幫助中心域名知識|虛擬主機知識|VPS主機知識|服務(wù)器知識|網(wǎng)站建設(shè)知識|網(wǎng)絡(luò)推廣
2、以安全模式啟動MySQL
Linux下,運行 /usr/local/mysql/bin/mysqld_safe --skip-grant-tables &
Windows下,在命令行下運行 X:/MySQL/bin/mysqld-nt.exe --skip-grant-tables
仿牌空間、香港月付空間、韓國月付空間、日本月付空間、荷蘭VPS、香港VPS
3、完成以后就可以不用密碼進入MySQL了
Linux下,運行 /usr/local/mysql/bin/mysql -u root -p 進入
Windows下,運行 X:/MySQL/bin/mysql -u root -p 進入
美國月付空間、月付美國空間、美國VPS、美國服務(wù)器租用
4、更改密碼
>use mysql
>update user set password=password("新密碼") where user="root";
>flush privileges;
注:如是4.1以上版本則使用old_password()函數(shù)進行密碼更改。
更多技術(shù)知識,更多網(wǎng)絡(luò)服務(wù),盡在宇塵網(wǎng)絡(luò)。我們的成長,離不開你們的支持,宇塵網(wǎng)絡(luò),歡迎您的訪問。