1. 今天剛裝了mysql8.0.13,試着分配幾個賬號和權限,結果報錯:
![]()
2. 查資料得知mysql8的分配權限不能帶密碼隱士創建賬號了,要先創建賬號再設置權限
輸入命令:Grant all privileges on test.* to 'test'@'%';
又報錯:You are not allowed to create a user with GRANT ;
不允許使用grant命令,怎麼會沒權限,奇怪。
3.後來想到了mysql數據表user中的host
進入mysql庫,use mysql;
於是修改host:update user set host='%' where user='test';
執行兩次,第一次報錯第二次修改成功
Grant all privileges on test.* to 'test'@'%';
成功:
但連接Navicat報錯
這是因爲mysql8的加密方式和Navicat不一樣
4.修改加密方式:alter user test identified with mysql_native_password by 'xxx';
再試,搞定!