2

我已经添加并且可以毫无问题地使用我的生产数据源,但是我在使用第二个“本地”数据源时遇到了问题。我的连接设置如下所示:

数据库地址:jdbc:mysql://localhost:3306/<database_name>

用户:<username>

密码:<password>

测试连接成功,我可以看到表格列表,但无法读取表格内容。是的,该用户拥有对相关数据库的完全访问权限;我在 MySQL Workbench 中确认了这一点。该问题似乎特定于 IntelliJ-IDEA。

IntelliJ-IDEA 抱怨道:

java.sql.SQLException: SELECT command denied to user ''@'%' for column 'mycolumn'

通知user''@'%'错误消息中。出了什么问题?

同样,测试连接成功,我可以看到表列表,并且上述用户在 MySQL Workbench 中工作得很好(可以选择/更新/插入所有表)。

我正在运行 IntelliJ-IDEA 版本 12.1.4。

错误信息截图

整个连接错误:

database_name.*
java.sql.SQLException: SELECT command denied to user ''@'%' for column 'column_name' in      table 'table_name'
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  at     sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
  at     sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.    java:45)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
  at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
  at com.mysql.jdbc.Util.getInstance(Util.java:386)
  at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054)
  at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4190)
  at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4122)
  at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2570)
  at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2731)
  at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2812)
  at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2761)
  at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1612)
  at com.mysql.jdbc.DatabaseMetaData$2.forEach(DatabaseMetaData.java:2571)
  at com.mysql.jdbc.DatabaseMetaData$2.forEach(DatabaseMetaData.java:2458)
  at com.mysql.jdbc.IterateBlock.doForAll(IterateBlock.java:51)
  at com.mysql.jdbc.DatabaseMetaData.getColumns(DatabaseMetaData.java:2457)
  at   com.intellij.persistence.jdbc.impl.RemoteDatabaseMetaDataImpl.getColumns(RemoteDatabaseMetaDataImpl.java:170)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
  at sun.rmi.transport.Transport$1.run(Transport.java:177)
  at sun.rmi.transport.Transport$1.run(Transport.java:174)
  at java.security.AccessController.doPrivileged(Native Method)
  at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
  at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:556)
  at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:811)
  at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:670)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
  at java.lang.Thread.run(Thread.java:724)
  at   sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:275)
  at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:252)
  at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:161)
  at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:194)
  at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:148)
  at com.sun.proxy.$Proxy147.getColumns(Unknown Source)
  at sun.reflect.GeneratedMethodAccessor398.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at com.intellij.execution.rmi.RemoteUtil$RemoteInvocationHandler.invoke(RemoteUtil.java:211)
  at com.sun.proxy.$Proxy148.getColumns(Unknown Source)
  at com.intellij.javaee.dataSource.DatabaseSchemaLoader.loadTableBasicsInner(DatabaseSchemaLoader.java:998)
  at com.intellij.javaee.dataSource.DatabaseSchemaLoader.loadTableBasics(DatabaseSchemaLoader.java:961)
  at com.intellij.javaee.dataSource.DatabaseSchemaLoader.loadElementDetails(DatabaseSchemaLoader.java:891)
  at com.intellij.javaee.dataSource.DatabaseSchemaLoader.loadDataSourceState(DatabaseSchemaLoader.java:113)
  at com.intellij.javaee.dataSource.AbstractDataSource.refreshMetaData(AbstractDataSource.java:49)
  at com.intellij.javaee.dataSource.AbstractDataSource$1.perform(AbstractDataSource.java:27)
  at com.intellij.javaee.dataSource.AbstractDataSource$1.perform(AbstractDataSource.java:25)
  at com.intellij.javaee.dataSource.DataSource.performJdbcOperation(DataSource.java:296)
  at com.intellij.javaee.dataSource.AbstractDataSource.refreshMetaData(AbstractDataSource.java:25)
  at com.intellij.javaee.module.view.dataSource.DataSourceUiUtil$2.run(DataSourceUiUtil.java:120)
  at com.intellij.openapi.progress.impl.ProgressManagerImpl$TaskRunnable.run(ProgressManagerImpl.java:495)
  at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:185)
  at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:226)
  at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:175)
  at com.intellij.openapi.progress.impl.ProgressManagerImpl$8.run(ProgressManagerImpl.java:400)
  at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:454)
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
  at java.util.concurrent.FutureTask.run(FutureTask.java:262)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
  at java.lang.Thread.run(Thread.java:724)
  at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:152)
4

1 回答 1

2

我有一个看法。正如另一篇帖子(信用:@FooBarUser)所建议的,我将视图的“定义”更改为有效的本地用户,问题就解决了!

于 2013-09-29T02:09:02.940 回答