之前测试环境用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 *.*
来进行:
grant reload on *.* to 'user_name'@'%';