mysql實(shí)現(xiàn)不用密碼登錄的實(shí)例方法
具體方法:
第一步:停止mysql服務(wù)
/etc/init.d/mysqld stop
第二步:跳過密碼驗(yàn)證
/usr/bin/mysqld_safe --skip-grant-tables
或
mysqld_safe --skip-grant-tables
跳過權(quán)限表啟動(dòng)mysql。
第三步:另開一個(gè)命令提示符窗口
use mysql;#刪除的記錄要insert進(jìn)去,然后修改密碼update user set password=password('new_pass') where user='root';
第四步:刷新權(quán)限
flush privileges;
內(nèi)容擴(kuò)展:
解決MySQL不需要密碼就能登錄問題
因?yàn)閳?zhí)行了一個(gè)更改數(shù)據(jù)庫(kù)root用戶密碼的命令,當(dāng)我更改完后,發(fā)現(xiàn)用我新密碼和舊密碼都能登陸,于是感覺沒有輸密碼,直接回車就能登錄,而我在配置中也沒有進(jìn)行免密碼登陸的操作,最后,執(zhí)行了一條命令解決update user set plugin = 'mysql_native_password';
修改密碼及解決無密碼登陸問題都在下面命令中:
> use mysql;> update user set authentication_string=password('你的密碼') where user=’root’; #(無password字段的版本,也就是版本<=5.7的)> update user set password=password(’你的密碼’) where user=’root’; #(有password字段的版本,版本>5.7的)> update user set plugin='mysql_native_password'; > flush privileges;> exit;
重啟mysql服務(wù)
以上就是mysql實(shí)現(xiàn)不用密碼登錄的實(shí)例方法的詳細(xì)內(nèi)容,更多關(guān)于mysql如何實(shí)現(xiàn)不用密碼登錄的資料請(qǐng)關(guān)注好吧啦網(wǎng)其它相關(guān)文章!
相關(guān)文章:
1. Mysql故障排除:Starting MySQL. ERROR! Manager of pid-file quit without updating file2. 數(shù)據(jù)庫(kù)Oracle9i的企業(yè)管理器簡(jiǎn)介3. 如何監(jiān)控Oracle索引的使用完全解析4. VS自帶的SQL server修改密碼并連接使用5. Windwos下MySQL 64位壓縮包的安裝方法學(xué)習(xí)記錄6. 用 SQL 查詢 DB2 XML 數(shù)據(jù)(1)7. 導(dǎo)出錯(cuò)誤編碼的mysql數(shù)據(jù)庫(kù)8. MySQL插入數(shù)據(jù)時(shí),如果記錄不存在則insert,如果存在則update9. MySQL存儲(chǔ)過程in、out和inout參數(shù)示例和總結(jié)10. DB2數(shù)據(jù)庫(kù)為單個(gè)會(huì)話鎖定技巧
