我们正在使用 jooq codegen 插件为 MySQL 数据库之一生成 dao 和 pojo 类。配置如下:
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<version>3.14.3</version>
<configuration>
<jdbc>
<driver>com.mysql.jdbc.Driver</driver>
<url>MYSQL_HOST</url>
<user>MYSQL_USER</user>
<password>MYSQL_PASSWORD</password>
</jdbc>
<generator>
<database>
<includes>some_db.*</includes>
</database>
<generate>
<daos>true</daos>
<pojos>true</pojos>
</generate>
<target>
<packageName>mysql</packageName>
<directory>target/generated-sources</directory>
</target>
</generator>
</configuration>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
当插件的 generate 目标被触发时,它会失败并出现以下错误:
Error running jOOQ code generation tool: Error generating code for catalog: org.jooq.exception.DataAccessException: SQL [select mysql.proc.db as ROUTINE_SCHEMA, mysql.proc.name as ROUTINE_NAME, mysql.proc.comment as ROUTINE_COMMENT, mysql.proc.param_list, mysql.proc.returns, mysql.proc.type as ROUTINE_TYPE from mysql.proc where mysql.proc.db in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) order by 1, 2, 6]; SELECT command denied to user 'MYSQL_USER'@'some_ip' for table 'proc' -> [Help 1]
请注意,使用 MYSQL_USER 没有也不能访问mysql
数据库。有什么方法可以让我们继续使用 codegen 插件吗?
更新:尝试使用与插件版本相同的配置3.10.5
。没有错误。