I have already uploaded some files in the free web host I chose and created a database there using phpMyAdmin v2.11.4

Also, I have Googled first this question before posting this here but I don't understand some rules and I need a clarification.

The exact error I get from viewing my uploaded file(index.php) is this:

Warning: mysqli_connect() [function.mysqli-connect]: (HY000/1130): Host '' is not allowed to connect to this MySQL server in /home/a6400350/public_html/subdomains/index.php on line 7

Domain name of free web host I'm using is www.000webhost.com

And my php code for connecting to host is:


$host = "sql10.000webhost.com"; //or ""
$username = "a6400350xxxxxx";
$password = "••••••••";

$con = mysqli_connect($host, $username, $password);

  • I also check if the server is down here or it's just me
  • There was also no previlege section in phpMyAdmin page as other suggest

Don't I have any permission to connect programmatically to this host as I am just a free user?


I'm also thinking of uploading the whole XAMPP in the server so I could do the things I'm imagining.

Edit 2

Also one more thing, I imported the database by means of .sql file locally through that server, maybe this has something to do about it?


Host is not allowed to connect to MySQL Error 1130 is a networking error. The server cannot resolve the hostname of the client. Or the host is not allowed to connect to the MySQL server.

There are basically 2 categories of possible reasons:

* The simple one:

In MySQL a user a user is specified using BOTH the user name and the host from where the user may connect. If no user has been created where the host-part (using wildcards or not) mathces the host of the client trying to connect MySQL will return this error.

* Specific for MySQL 5.7:

When upgrading to MySQL 5.7.3 from a previous version this may occur due to changes to the user table introduced in 5.7.3. There is a good blog about this here http://www.chriscalender.com/?p=1392

For more information refer this bit.ly/1mFcStA

  • For your first solution, I guarantee that the user is up and existing and provided the correct login details.For your second solution, I imported the database by means of .sql file w/c is generated by updated version of MySQL and was parsed by this old version of that kind. However, I cannot do what the link you've mentioned did because it's on the other computer. – mr5 May 9 '14 at 0:31

Most hosting companies provide interface, where you can specify (wild-card % is allowed, which means that every host can connect to the database server, or you can specify only given IP addresses) if the remote computers can connect to the MySQL database.

This option should be inside your hosting account's Administration panel (if you have CPanel it is under section Databases->Remote MySQL).

If you do not use CPanel, then consult with your hosting company, but this option is definitely not in PHPMyAdmin.

  • I cannot find Databases->Remote MySQL there, seems nothing there. What's up with this % thing? How can I use it to check if I'm able to use MySQL programmatically? – mr5 May 8 '14 at 9:20
  • What type of control panel do you use when log in ? – bodi0 May 8 '14 at 9:23
  • I don't know what type is it but, there's a built-in control panel there (A GUI thing) with lots of tools. One of them is this phpMyAdmin and I can access my database there manually. – mr5 May 8 '14 at 9:28

Where are you running your script? Locally or on the free hoster you talk about?

If you are running it on the hoster, you may want to try localhost as $host. Alternatively read the documentation of the hoster for the correct access settings. This should work then.

If you are running your script locally, and want to connect to the database of your hoster: Yes, you will most likely not be allowed to do that.
You can run a local MySQL server instead, which has nothing to do with your free hoster. You then again can use localhost for $host, as the MySQL server will run on your local machine then.

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.