Enable Remote Access for MySQL

To enable logins from other locations you need to:


1) ssh to the server and edit the my.cnf (located in /etc/my.cnf or /etc/mysql/my.cnf

2) Add the line “bind-address=”. This allows for localhost and remote connections.

3) Create or Modify a user to have permissions to connect to the server. Assuming the user already exists, connect to the mysql server as an administrator. Then type one of/or all of the following (depending on need)


GRANT ALL ON *.* TO username@'%';

GRANT ALL ON *.* TO username@'localhost';

GRANT ALL ON *.* TO username@'X.X.X.X';


Were % is ALL source IP address’s, localhost is only from the localhost, X.X.X.X is allow user from this source IP address.


This grants that user access to ALL databases on the server. To limit access to only certain databases then replace *.* with




You might also need to create/modify the user:


Create user username@'X.X.X.X' IDENTIFIED BY 'userpassword';

Create user username@'%' IDENTIFIED BY 'userpassword';

create user username@'localhost' IDENTIFIED BY 'userpassword';

Was this article helpful?
0 out of 0 found this helpful

Have more questions? Contact our support instantly via Live Chat