0

I am doing Remote database connection in php, and getting this error:

Warning: mysql_connect(): Host 'AT-PC-6' is not allowed to connect this MySql server in C:\xampp\htdocs\programs\remote.php on Line ($con=mysql_connect('192.168.1.57','root','') or die ("Conection Failed");)

Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
Baikare Sandip
  • 751
  • 1
  • 6
  • 19
  • 2
    Have you tried `($con=mysql_connect('localhost','root','')` or `($con=mysql_connect('127.0.0.1','root','')`? Plus check and see which PHP version you have. If you're on PHP 5.5, `mysql_*` have been deleted from that version. Use `mysqli_*` => `mysqli_connect` – Funk Forty Niner Mar 20 '14 at 04:54
  • Are you connecting to a db from a different PC? – Eddie Mar 20 '14 at 04:57
  • Hope this could help http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html – Muhammed Basil Mar 20 '14 at 04:58
  • You need to specifically allow that host to connect, try `CREATE USER 'username'@'AT-PC-6' IDENTIFIED BY 'password';` from the server as root, then connect using username and password from the CREATE USER query. – drew010 Mar 20 '14 at 04:59
  • http://stackoverflow.com/questions/1935314/connecting-to-remote-mysql-server-using-php – kraysak Mar 20 '14 at 05:00
  • Ya i am using PHP 5.5 i think i have to use mysqli_* => mysqli_connect – Baikare Sandip Mar 25 '14 at 05:51

0 Answers0