I have installed Apache, PHP, MySql on a Windows 2008 Server. The problem is that I am trying to connect to MySql from my home machine. I have enabled TCP/IP networking in the MySql Configuration Wizard and opened the port (3306) in the firewall (for my home ip). But when trying to connect with HeidiSql , I am getting error 1130 the host is not allowed to connect.

How do i fix this?

  • 1
    Hang on, so your Server 2008 machine is in work and you are trying to connect to it from home? And the webserver/database server is directly connected to the internet? – tombull89 Mar 16 '12 at 13:36
  • If you think his set up is flawed, then say so.. asking condescending rhetorical questions helps no one. – Safado Mar 16 '12 at 14:05
  • 1
    @Safado - I don't know if it is - I was asking for clarification as the OP does not make it obvious. – tombull89 Mar 16 '12 at 14:14
  • I don't really get what's going on here but yeah the webserver is connected "directly" to the internet, otherwise it would be a rather pointless webserver, or what? – Jesper Mar 16 '12 at 15:56

Look at the grants for your user.

In MySQL, grants are defined by the couple login, host. Maybe your user is only allowed to connect from localhost.

A show grants for user@'%'; will show you if you are allowed to connect, or not.

  • This is one thing I didn't understand when I first started to learn mysql. THe user's are basically set up as user@location. If you do a select user,host from mysql.user; you can see all the users that are allowed to connect and where they can connect from. Then you use the show grants command that Jeremy mentioned to see what permissions they have to what databases/tables. – Safado Mar 16 '12 at 14:08
  • the query show grants for user@'%'; gives me this: ERROR 1141 (42000): There is no such grant defined for user 'hmadmin' on host '% ' – Jesper Mar 16 '12 at 15:53
  • the query select user,host from mysql.user gives me my three users (root and two more) and localhost on all three – Jesper Mar 16 '12 at 15:53
  • Jeremy C. & @Safado: You guys have solved my problem. I created a user like 'username'@'myhomeip' and gave him some grants and that worked like a charm – Jesper Mar 16 '12 at 16:04

I believe remote connections are enabled by default. See this article for step by step on how to enable:



On your server run mysql from command line:

mysql -u root -p -h localhost -P 3306

Then run this command in mysql shell:

>use mysql
>GRANT ALL ON *.* to root@'%' IDENTIFIED BY 'pass';

Have a nice time.

  • One sure fire way to bring yourself to the attention of the system is to post identical answers to questions - please don't. Also from a security point of view allowing root to access from anywhere isn't great either. – Iain Dec 18 '12 at 9:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.