Mysql資料庫許可權問題

Codeagles發表於2018-07-10

版權宣告:本文為 Codeagles 原創文章,可以隨意轉載,但必須在明確位置註明出處!!!

##解決 java.sql.SQLException: The user specified as a definer ('root'@'%') does not exist

####現象 在新安裝的Mysql資料庫中,建立資料庫等基礎操作後,利用java後端去執行讀取資料庫的時候,可能會出現java.sql.SQLException: The user specified as a definer ('root'@'%') does not exist該條錯誤資訊。 ####原因 許可權問題,需要授權給 root 所有sql 許可權(這裡賬戶為root) ####解決方法 在Mysql命令列中執行下面命令賦予許可權,重新啟動Mysql服務即可。

mysql> grant all privileges on *.* to root@"%" identified by ".";
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
複製程式碼

相關文章