By default, MySQL does not allow remote clients to connect to the MySQL database.
If you try to connect to a remote MySQL database from your client system, you will get “ERROR 1130: Host is not allowed to connect to this MySQL server” message as shown below.
$ mysql -h 192.168.1.8 -u root -p Enter password: ERROR 1130: Host '192.168.1.4' is not allowed to connect to this MySQL server
You can also validate this by doing telnet to 3306 mysql port as shown below, which will also give the same “host is not allowed to connect to this mysql server” error message as shown below.
$ telnet 192.168.1.8 3306 host 192.168.1.4 is not allowed to connect to this mysql server
If you want to allow a specific client ip-address (for example: 192.168.1.4) to access the mysql database running on a server, you should execute the following command on the server that is running the mysql database.
$ mysql -u root -p Enter password: mysql> use mysql mysql> GRANT ALL ON *.* to root@'192.168.1.4' IDENTIFIED BY 'your-root-password'; mysql> FLUSH PRIVILEGES;
Also, update firewall rules to make sure port# 3306 is open on the server that is running the mysql database.
After the above changes, when you try to connect to the mysql database from a remote client, you’ll not get the “Host is not allowed to connect to this MySQL server” error message anymore.
Linux provides several powerful administrative tools and utilities which will help you to manage your systems effectively. If you don’t know what these tools are and how to use them, you could be spending lot of time trying to perform even the basic administrative tasks. The focus of this course is to help you understand system administration tools, which will help you to become an effective Linux system administrator.Get the Linux Sysadmin Course Now!
If you enjoyed this article, you might also like..
|
|
|
|






My name is Ramesh Natarajan. I will be posting instruction guides, how-to, troubleshooting tips and tricks on Linux, database, hardware, security and web. My focus is to write articles that will either teach you or help you resolve a problem. Read more about
{ 31 comments… read them below or add one }
It worked. Thanks a lot!
Worked 4 me.Thanx
Thank you very much!
worked for me . Thanks a lot
And ‘root’ can also be the name of a particular database? I prefer to keep all other databases on the same IP untouched.
Best,
Caroline
Thanks it worked
This just saved my sanity!!!! Thanks!
Thanks a lot, this worked very well for me!
Thanks works like charm on MySQL5.1
Thanks for help …. it works perfect
why that does not work for me?
how to update filewall rule?
Thanku very muchhhhhhhhhh
Thanx for your query. It really working fine. Thanks again
worked for me, thanks a ton
Worked for myself……..
It is instructive. I recommand this to these use MySql
If you want to allow all clients to connect you may do following
GRANT ALL ON *.* to root@’%’ IDENTIFIED BY ‘your-root-password’;
hi but why we do that? is it secure to make a connection with remote computer this way?
Is it practical?
I recommend to use ssh for remote communication it’s easy and secure
anyway remote computer firewall also needs to accept communication with the target mysql. so in the firewall settings of the remote sever u should make a new rule to accept communication from local ip address.
Works like charm thanks
Hi, thank you for this, it helped me.
Just a precision : FLUSH PRIVILEGES is not needed with GRANT command.
You only need it when you change a table manually (UPDATE, DELETE, etc).
I am also trying to configure MySQL in client-server architecture.
1) Do I need to install mysql client on all machine, which I want to use as client?
2) What are the things, I need to take care?
worked
thanks
U saved my day..thanks a lot..it worked.
It did save my day.. Thanks a lot.. was banging my head whats wrong.. thanks a lot.. this really helped
Worked for me…. Thank you:-)
Have to edit /etc/mysql/my.cnf
.
.
Bind-address = 127.0.0.1
Change to
Bind-address = 0.0.0.0
When I got this message, it was because of a typo in one of the /etc/hosts files — I had “.con” instead of “.com” at the end of an entry.
If what’s recommended here doesn’t work for you, check name resolution!
Hi,
Thanks for info , but it’s only working in local machine not on remote machine.
it’s replacing localhost to ip of machine ,
But if i want to database from another machine , is there any way to access that.
thnks ….
it really healped
thanks a lot for your help
How to Allow MySQL Client to Connect to Remote MySQL server using PHP page. it is connecting using command line i.e. $mysql -h 0.0.0.0 -u xyz -p