之前測試環境用root沒這個問題。換到生產環境指定的某個mysql賬號出現權限不足:
Caused by: java.sql.SQLSyntaxErrorException: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:764) at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:648) at io.debezium.jdbc.JdbcConnection.executeWithoutCommitting(JdbcConnection.java:1323) at io.debezium.connector.mysql.SnapshotReader.execute(SnapshotReader.java:483)
需要修改:這類權限的授權不是針對某個數據庫的,因此須使用on *.*來進行:
會遇到一系列權限問題,正常的用戶權限設置如下:
CREATE USER 'bigdata'@'%' IDENTIFIED BY 'password';
GRANT SELECT, RELOAD, SHOW DATABASES, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'bigdata' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
