Warning: mysql_connect() [function.mysql-connect]: Host ‘xxx.xxx.xxx.xxx’ is not allowed to connect to this MySQL server

Pernah ngalamin hal yang kaya gini ga fiuph,, minggu-minggu ini setelah upload file ke 000webhost.com ternyata muncul

Warning: mysql_connect() [function.mysql-connect]: Host ’31.170.163.84′ is not allowed to connect to this MySQL server in /home/a6709718/public_html/koneksi.php on line 6

Host ’31.170.163.84′ is not allowed to connect to this MySQL server. Padahal klo di webhosting yang berbayar setting koneksi yang digunain ini bisa langsung connect ke Database MySQL.

Sempet bingung dan sampe browsing kesana kemari Tanya om google berkali” ternyata masih dapet jawaban yang belum pasti L. Tapi akhirnya ketemu juga permasalahnnya adalah kesalahan memasukkan alamat di hostname. Seharusnya yang dimasukkan adalah MySQL host yang diberikan oleh 000webhost.com bukan memasukkan nama domain website (xxxx.co.cc) :D

Awalnya :

<?php

$host = ‘xxxxx.co.cc’; //hostname

$user =’a67xxxxx_xxxx’; //MySQL username

$pass = ‘xxxxx’; //MySQL password

$db = ‘a67xxxxx_xxxxx’; //Database name

mysql_connect($host,$user,$pass) or die (mysql_error());

mysql_select_db($db’) or die (“cannot select DB”);

?>

 

Akhirnya :

<?php

$host = ‘mysqlx.000webhost.com’; //MySQL Host

$user =’a67xxxx_xxxx’; //MySQL username

$pass = ‘xxxxx’; //MySQL password

$db = ‘a67xxxxx_xxxxx’; //MySQLDatabase name

mysql_connect($host,$user,$pass) or die (“Gagal Koneksi ke Data base karena “.mysql_error());

mysql_select_db(‘$db’) or die (“cannot select DB”);

?>

 

Dan akhirnya website dapat terkoneksi dengan database :D

Tinggalkan Balasan

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Ubah )

Twitter picture

You are commenting using your Twitter account. Log Out / Ubah )

Facebook photo

You are commenting using your Facebook account. Log Out / Ubah )

Connecting to %s

Ikuti

Get every new post delivered to your Inbox.