I’m having trouble setting up database access for a third-party service integration. Even though my MySQL user account has full privileges, I keep running into permission issues when trying to grant SELECT access to another user.
Here’s the command I’m using:
GRANT SELECT ON company_db.orders_table TO 'api_user'@'192.168.1.100' IDENTIFIED BY 'secure_password123';
But I keep getting this error message:
#1044 - Access denied for user 'admin'@'localhost' to database 'company_db'
This is really frustrating because the user account I’m logged in with should have all the necessary permissions. Has anyone encountered this before? What am I missing here?
The IDENTIFIED BY clause in your GRANT statement is probably the culprit. That syntax is deprecated in newer MySQL versions and can throw permission errors even when you’ve got the right privileges. Split it into two commands instead: first CREATE USER ‘api_user’@‘192.168.1.100’ IDENTIFIED BY ‘secure_password123’; then GRANT SELECT ON company_db.orders_table TO ‘api_user’@‘192.168.1.100’;. Also check that your admin user actually has GRANT OPTION privileges on that specific database, not just global ones. Run SHOW GRANTS FOR CURRENT_USER(); to see exactly what permissions you have.
double-check ur hitting the right MySQL instance - I’ve seen this when multiple servers run on different ports. run FLUSH PRIVILEGES; after granting permissions since MySQL sometimes doesn’t refresh the privilege cache. Error 1044 typically means the user needs database-level access even with global privileges.
Had this exact problem last month during a database migration. Your syntax looks fine - the real issue is how MySQL handles database privileges. You might have global privileges but not on that specific database. First, try USE company_db; to see if your admin account can even access it. If it fails, you’ll need someone with root access to grant you privileges on company_db specifically. Also double-check the database name - I’ve seen databases exist but with slightly different names than expected. Run SHOW DATABASES; to confirm company_db is there and accessible.