Reputation: 157
I am creating an API REST aplication with Symfony3, and I have this problem. When I execute the methods in localhost it works fine, but I have uploaded the project to a server administered with Plesk, and when I try to execute the methods with postman, it shows this:
An exception occurred while executing 'SELECT t0.random_id AS ...' with params [\"a\", \"a\"]:\n\nSQLSTATE[42000]: Syntax error or access violation: 1142 SELECT command denied to user 'app'@'localhost' for table 'table_name'
It seems to be a permissions problem, but if I try to access to the database with MysQL Workbech, with the same credentials, I can do it and execute querys without problems. And in the Plesk panel, the user has all the permissions and privileges.
I have also tried changing "localhost" for the host address in the parameters file of Symfony.
Upvotes: 0
Views: 2119
Reputation: 1499
Looks like app
user doesn't have permissions to execute SELECT
query.
Run following MySQL query to fix it:
GRANT SELECT on database_name.* to 'app'@'localhost' identified by 'your-pass';
FLUSH PRIVILEGES;
Upvotes: 1