mysql 8.0.15版本安裝後提示The user specified as a definer ('root'@'%') does not exist權限問題

1.先看下mysql是否設置了環境變量,若是沒設置,就須要切換到mysql的bin目錄下執行命令mysql

mysql -hlocalhost -uroot -p123456

2.給root用戶添加權限sql

mysql8.0之前的版本能夠使用grant在受權的時候隱式的建立用戶,8.0之後已經不支持,因此必須先建立用戶,而後再受權,命令以下:ide

CREATE USER 'root'@'%' IDENTIFIED BY '123456'加密

grant all privileges on *.* to 'root'@'%';
flush privileges;
若是遠程鏈接的時候報plugin caching_sha2_password could not be loaded這個錯誤,能夠嘗試修改密碼加密插件:
alter user 'root'@'%' identified with mysql_native_password by '123456';
相關文章
相關標籤/搜索