• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.5 MySQL - Connection refused with seemingly correct username/pw

#1
Hey,
I'm getting the error 'Connection refused' during the installation of xenForo.
Unfortunately it seems like I entered all the data correctly and I can connect to the DB if I just use a small script like that:
<?php
$host_name = "localhost:/tmp/mysql5.sock";
$database = "db618287096";
$user_name = "dbo618287096";
$password = "password is usually here";

$connect = mysql_connect($host_name, $user_name, $password);
if(mysql_errno()) { echo '<p>Connection failed: '.mysql_error().'</p>'; }
else { echo '<p>Connection established</p>'; }
?>
The output with the correct PW is as expected: Connection established.

During the xenForo installation I get this screen, fill it all in, like this

and then on the next screen I get the error message about the connection being refused.
 

Brogan

XenForo moderator
Staff member
#2
If you are sure the database name, user name and password are correct, try changing the MySQL Server field to the default, localhost.
 
#3
If I do that, I get the following error:
The following error occurred while connecting to the database:

No such file or directory

Which is the same error I get with my little script, if I change the host to just localhost.
The username/pw/host are the same in my script and on the xenForo-install page.
 

Mike

XenForo developer
Staff member
#4
mysqli_connect doesn't support setting the socket in that manner. You would either need to use 127.0.0.1 to bypass the socket or manually create config.php and use ini_set to change mysqli.default_socket to point to your socket file.