您的位置:首頁/技術文章
文章詳情頁

mysql實現不用密碼登錄的實例方法

瀏覽:45日期:2023-10-12 11:30:21

具體方法:

第一步:停止mysql服務

/etc/init.d/mysqld stop

第二步:跳過密碼驗證

/usr/bin/mysqld_safe --skip-grant-tables

mysqld_safe --skip-grant-tables

跳過權限表啟動mysql。

第三步:另開一個命令提示符窗口

use mysql;#刪除的記錄要insert進去,然后修改密碼update user set password=password('new_pass') where user='root';

第四步:刷新權限

flush privileges;

內容擴展:

解決MySQL不需要密碼就能登錄問題

因為執行了一個更改數據庫root用戶密碼的命令,當我更改完后,發現用我新密碼和舊密碼都能登陸,于是感覺沒有輸密碼,直接回車就能登錄,而我在配置中也沒有進行免密碼登陸的操作,最后,執行了一條命令解決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服務

以上就是mysql實現不用密碼登錄的實例方法的詳細內容,更多關于mysql如何實現不用密碼登錄的資料請關注好吧啦網其它相關文章!

標簽: MySQL 數據庫
相關文章:
国产综合久久一区二区三区