我在MySQL數據庫服務器上部署了我的數據庫。我有一個用戶'bedgeaj_root @ localhost',它擁有所有權限。但它仍然給我的錯誤:對錶'table'的用戶'user''localhost'拒絕SELECT命令
SELECT command denied to user 'bedgeaj_root'@'localhost' for table 'transactions'
雖然在網上搜索,我的研究,這是有些用戶權限問題。但我不明白,爲什麼它給這個錯誤,因爲我已經給這個用戶的所有權限。
這裏是我的cPanel用戶權限屏幕的截屏:
這裏去我的堆棧跟蹤:
Caused by: net.sf.jasperreports.engine.JRException: Error executing SQL statement for : itemizedStatementReport_patientBalance
at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.createDatasource(JRJdbcQueryExecuter.java:246)
at net.sf.jasperreports.engine.fill.JRFillDataset.createQueryDatasource(JRFillDataset.java:1073)
at net.sf.jasperreports.engine.fill.JRFillDataset.initDatasource(JRFillDataset.java:667)
at net.sf.jasperreports.engine.fill.JRBaseFiller.setParameters(JRBaseFiller.java:1235)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:859)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:804)
at net.sf.jasperreports.engine.fill.JRFillSubreport.fillSubreport(JRFillSubreport.java:652)
at net.sf.jasperreports.engine.fill.JRSubreportRunnable.run(JRSubreportRunnable.java:59)
at net.sf.jasperreports.engine.fill.JRThreadSubreportRunner.run(JRThreadSubreportRunner.java:205)
... 1 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: SELECT command denied to user 'bedgeaj_root'@'localhost' for table 'transactions'
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:407)
at com.mysql.jdbc.Util.getInstance(Util.java:382)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3603)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3535)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1989)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2150)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2626)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2281)
at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.createDatasource(JRJdbcQueryExecuter.java:239)
... 9 more
我使用此查詢:
SELECT alias.patient_id , SUM(alias.balance) AS balance
from (
SELECT v.patient_id,trx.trx_id,trx.trx_status,trx.trx_seq,pb.billing_id,v.visit_id,v.visit_dt,forma t(SUM(tl.net_amount) - ifnull((SELECT SUM(pl.applied_amount+pl.discount_amount) FROM payment_lines pl where pl.trx_line_id = tl.trx_line_id),0.0),2)AS balance
FROM ((transactions trx JOIN trx_lines tl ON (trx.trx_id = tl.trx_id))JOIN patient_billing pb ON(pb.billing_id = trx.billing_id))JOIN visits v ON (pb.visit_id = v.visit_id)
where trx.trx_seq='4' AND trx.trx_status='PENDING' AND (date_format(v.visit_dt,'%Y/%m/%d')<date_format(DATE_SUB(NOW(), INTERVAL 1 day),'%Y/%m/%d'))
group by tl.trx_id) alias
where alias.patient_id = $P{patient_id}
group by alias.patient_id]
我做錯了什麼?
「,因爲我已向該用戶授予所有權限。」 - 不會出現那種方式。 –
我已經爲用戶指定了bedgea_root @ localhost的所有權限,包括SELECT權限。除一個特定的查詢外,其他所有查詢均可正常運行 –
CURRENT_USER的SHOW GRANTS;你得到了什麼? – Mihai