I cannot connect MYSQL when I'm usıng to my Domain.

Posted December 10, 2016 2k views
MySQLUbuntu 16.04

When I entered domainname/phpmyadmin I can Connect MYSQL without any error.

But, I cannot connect MYSQL when I’m usıng connect.php file.
connect.php files include:
$servername = “domaınname”;
$username = “root”;
$password = “

// Create connection
$conn = mysqli_connect($servername, $username, $password);

// Check connection
if (!$conn) {
die(“Connection failed: ” . mysqliconnecterror());
echo “Connected successfully”;*

and I’m writing this to firefox : domainname/connect.php
I get thıs error
Connection failed: Can’t connect to MySQL server on ‘domainName’ (111)

thank you

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.

Submit an Answer
1 answer

are you using apache? You might need to install some mods if you have not already:

sudo apt-get install libapache2-mod-auth-mysql php-mysql