0

I've newly set up a VPS and installed WHM.

I have a MySQL DB on this server which I am able to connect with using a desktop SQL application called Sequel Pro.

Using PHP I have set up a subdomain which I want to connect to this DB, I have used the same details as the Desktop Client but I keep receiving PHP Warning: mysqli::mysqli(): (HY000/2003) messages in my PHP error_log.

I'm completely stumped as I thought I would be able to connect to the DB from another website. I have add % to the cPanel Remote MySQL® and still no luck.

Could someone please point me in the right direction.

<?php
$mysqli = mysqli_connect("HOST_IP","DB_USER","DB_PASS","DB_NAME");

// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }

$q = $mysqli->query("SELECT COUNT(*) FROM users");
print_r($q);
ngplayground
  • 20,365
  • 36
  • 94
  • 173

0 Answers0