skip to Main Content

I need to give a remote user access to a MySQL database. I also need to limit the permissions they have to the MySQL database tables. The current database contains approx. 50+ tables so rather than revoke permissions table by table, I’m trying to give the user access with no privileges and then add those that are needed. What I’ve done appears to work when:

  1. I’m logged in as root (via SSH)
  2. I login using “mysql -u username -p” – enter my password for the newly created user.

This users account honors all the privileges I’ve set up. However, when this user tried to connect via their desktop client – they can connect but can not view the database. When using “use databasename” they get this error:

Error Code: 1044. Access denied for user ‘username’@’%’ to database ‘database_name’

Not sure if this helps but I’m using Media Temple DV w/ Plesk. I’ve first added the user. Then I SSH in and revoked ALL privileges. Then I added the privileges for the user and did command “flush privileges”. Nothing is working. As I said, if I’m accessing via the command line (after SSHing in as root) the permissions are honored and I can access the database – just not remotely.

Any help would be greatly appreciated.

2

Answers


  1. May be network that is allowed to connect is localhost, but not users network IP.
    And check max connections amount.

    Login or Signup to reply.
  2. If you’re logged in as root via SSH and MySQL database is on the same machine, then i guess that if you run:

    mysql -u username -p
    

    you try to connect to MySQL as ‘username’@’localhost’ user.
    If you want to connect to MySQL database from outside of this server, you need to:

    • create user like ‘username’@’%’ which allow to connect to MySQL using ‘username’ from anywhere (‘%’)
    • allow mysql server to connect from outside by setting bind-address more details here
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search