因為執行了一個更改數據庫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服務