SQL Access Denied on some tables but not others

时间:2015-09-01 21:15:08

标签: mysql sql amazon-rds

Using Amazon RDS, I log into the MySQL DB and am able to edit tables (SELECT, INSERT, etc...). I have two tables (x and y). I have backend code which allows me to insert into table x, but it doesn't allow me to insert into table y. It gives me the error:

{ [Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'user'@'ip' (using password: YES)]
  code: 'ER_ACCESS_DENIED_ERROR',
  errno: 1045,
  sqlState: '28000',
  fatal: true }

Access is denied on that table to insert, but I am able to select. I'm not sure why this is happening.

1 个答案:

答案 0 :(得分:0)

In SQL you can grant specific permissions (insert, update, delete, select, etc..) per table, per view, per SPROC, etc..

I believe that the issue you are having is that the user connecting in the back-end (through the connection string) does not have proper permission to table y. The reason that you are able to insert into table y in MySQL is because you are logging in with more permissions (most likely an owner).

You need to grant more permissions to the user that is connecting to through the back-end / connection string of the application