Question
Mysql Refusing my Connection on a new install
Just installed LAMP following the instructions, I uploaded my code which was working perfecty locally and I got an Error500. Checked the apache logs and getting:
[Tue Apr 17 16:26:54.072762 2018] [:error] [pid 15636] [client 181.14.122.235:50286] PHP Warning: mysqli_connect(): (HY000/2002): Connection refused in /var/www/mywebsite.com/public_html/dbconnection.php on line 7, referer: http:/mywebsite.com/
My dbconnection file is:
<?php
//Establishing connection with the database
define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'root');
define('DB_PASSWORD', 'mypassword');
define('DB_DATABASE', 'mydbname'); //where customers is the database
$db = mysqli_connect(DB_SERVER,DB_USERNAME,DB_PASSWORD,DB_DATABASE);
?>
Data is correct since I used it to access phpmyadmin.
What else could this be?
Thanks!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×