ERROR 1130 (HY000): Host is not allowed to connect to this MySQL server

ERROR 1130 (HY000): Host is not allowed to connect to this MySQL server

If you are trying to log into mysql server of remote host and you are getting this error, there can be several reasons that you are getting this.

1) You can not log in with blank/No password on remote host  otherwise it gives following error

ERROR 1045 (28000): Access denied for user 'username'@'hostname' (using password: NO)
Generally root account does not have password and you use blank password to log into root account but there must be a password to log into remote host mysql server.
Do not change it with no password attribute just like your localhost. It is very important that remote host must have mysql password otherwise it would be biggest security loop hole.

2) If you have created new user and you have set password for it. Now it is time to check hostname. If you are logging into mysql server of remote host, you must be using IP for it's hostname. If hostname is localhost, you can not log into the mysql server. This host name is for users of the server, it is not for remote host.

3)  If hostname is IP of the server, still you can not log into the mysql server. This host name is for users of the server, still it is not for remote host.

4) Port 3306 should be opened on remote host and if server is RHEL, Fedora, CentOS or similar one. The port should be defined in IP table rules.

Host name should be '%' as well as username and password both should be defined for the host name or you can say A user should have host name '%' to log into mysql server on remote host.

Now you can log into mysql server on remote host using IP.

Set the proper permission(create/drop database, create/drop table etc) for this user using 
privileges options.

click on the image for readable view.

In this example, username is admin101 & admin11, password is admin and hostname is %. Now anyone can log in from remote host into this mysql server using IP as a hostname and above given username & password.

Be careful about privileges. User can misuse if you are not careful enough.
# mysql -h 192.168.1.7 -u admin101 -p'admin'

where 192.168.1.7 is IP of the remote server
admin101 is username of mysql user on remote host
admin is password for this user.
There is no space between -p & '

For mysql remote login, Read this.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...