Enterprise Architecture & Integration, SOA, ESB, Web Services & Cloud Integration

Enterprise Architecture & Integration, SOA, ESB, Web Services & Cloud Integration

Tuesday, 12 March 2013

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

By default, My SQL server does not allow remote access to the database, but often this is a requirement when you run your web/application server and database in two different machines.

You will have to put some extra work to make it working. The magic is that you will have to provide access to the client machine from which you are trying to access the remote server. While it may not be great  idea to provide root access to a client machine, this one will allow your client machine quickly to connect to the database server.

Here you go for step by step guide: -

Step1 : Log on to your remote mysql database server: mysql -u root -p
Step 2: Run the command to use mysql schema: use mysql
Step 3: Run the command to provide access: GRANT ALL ON *.* to 'root'@'<client-hostname or IP address>' IDENTIFIED BY '<your password>'
Ste 4: Run the command: flush PRIVILEGES

The above will allow you to access your database remotely.

Sometime, you may get an error "ERROR 1045 (28000): Access denied for user 'root'@'hostname' (using password: YES)". It is mostly due to an incorrect password.

No comments:

Post a Comment