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.
Comments on this entry are closed.
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
Can we write `%` instead client-ip-address to allow clients?
Thanks for this great info. I would like to add my two cents here since I had a problem with the password hash (I was using MySql Workbench instead of command line).
You need to query this first:
select password(‘you_password_goes_here’);
The result would be something like this
*502ADA1CCA0BC291A468FBDDA49C46BBC4AE7A2B
So just change this line to
IDENTIFIED BY PASSWORD ‘*502ADA1CCA0BC291A468FBDDA49C46BBC4AE7A2B’
With the value we got above.
Thanks again. Cheers!
Thanks guys…
thanks a lot.. meaningful explanation
Thanks. worked for me
merci Mr Jerry
This post is still helping folks. Great test and resolution.
Thanks
Awesome, thanks!
thanks, exactly what I needed 😀
Thanks!!!!
hi guys….can u explain me how to connect mysql server from REMOTE CLIENT via internet network ??????????? Means can we be able to connect mysql server thourgh internet as like above explained process ?? Here , only change is Client is Remote machine insteed of that is in same LAN network . Please help me..Thanks a lot..
Thanks a lot Man. It works!!!
Hello!,
I have a mysql server 5.5 installed in IP address 192.168.0.250 and I want my children
to access their mysql database through their independent user.
How could i achieve ?
Awaiting your prompt response.
Thanks
Manish Gupta
thank you very much, works for me
if you need to connect with phpmyadmin to your remote database just
#vi /usr/share/phpmyadmin/config.inc.php
and search for $cfg[‘Servers’][$i][‘host’] = ‘localhost’; and replace localhost with your remote server IP to be like that
$cfg[‘Servers’][$i][‘host’] = ‘192.168.1.9’;
Simple and clear,,,, thanks
It saved my day. Thanks a lot.
It worked for me.. Thanks a lot
Worked for myself
Thanks a lot. Finally it worked!
Awesome…it helped me.. Thank You
Thank you so much
How can we check the PRIVILEGES are properly set or not ?
Because after following your steps i am still getting that error.As my remote machine is connect in LAN to mysql server which is not having Firewall in between them.
Thanks!
thanks !!!