How to Allow Remote Clients to Connect MySQL Server


Many times we faced below issue when try to connect a remote MySQL server from client system and remote client is not allowed to access this MySQL server we faced issue like below.

mysql -h -u root -p

Enter password:

ERROR 1130 (HY000): Host ‘’ is not allowed to connect to this MySQL server
This issue is because that, If client system does not have permission to connect MySQL server. By default MySQL server doesnít allow any remote clients to connect.

Allow MySQL Client Connection:

To allow a client system to connect mysql server. Login to remote mysql server using ssh and then login to MySQL server locally. Now use following commands to allow remote client. For example if remote clientís ip is and trying to connect through mysql root account.

[ Below commands need to run on MySQL Server ]

# mysql -u root -p
Enter password:

mysql> GRANT ALL ON . to [email protected]’′ IDENTIFIED BY ‘new-password’;
mysql> quit
You have successfully created a new account in MySQL server to connect from specified client system.

Letís try to connect from clients system.

mysql -h -u root -p

[Sample Output]
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 27
Server version: 5.1.69 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.