Welcome Guest, Not a member yet? Register   Sign In
mysql connection refused
#5

(06-27-2018, 03:09 AM)InsiteFX Wrote: Create a new php file in where index.php is and add this then run it to test your connect.

PHP Code:
$servername "localhost";
$username   "username";
$password   "password";

// Create connection
$db = new mysqli($servername$username$password);

// Check connection
if ($db->connect_error)
{
 
   exit("Connection failed: " $db->connect_error);


echo 
"Connected successfully"

OK, after a lot of experimentation with your code above, I discovered that I was overthinking the problem.  Apparently, the complex string localhost:/db01/var/lib/mysql/mysql.sock is only required when attempting to connect to the database remotely.  Cut it down to just localhost and everything works now.  Thanks for your help.
Reply


Messages In This Thread
mysql connection refused - by jameshking - 06-26-2018, 03:36 PM
RE: mysql connection refused - by jlarroulet - 06-26-2018, 05:58 PM
RE: mysql connection refused - by jameshking - 06-26-2018, 06:46 PM
RE: mysql connection refused - by InsiteFX - 06-27-2018, 03:09 AM
RE: mysql connection refused - by jameshking - 06-27-2018, 03:07 PM
RE: mysql connection refused - by alamowais - 07-24-2018, 09:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB