1. 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

Discussion in 'Installation, Upgrade, and Import Support' started by octabrain, Mar 17, 2016.

  1. octabrain

    octabrain Member

    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:
    $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.
  2. Brogan

    Brogan XenForo Moderator Staff Member

    If you are sure the database name, user name and password are correct, try changing the MySQL Server field to the default, localhost.
  3. octabrain

    octabrain Member

    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.
  4. Mike

    Mike XenForo Developer Staff Member

    mysqli_connect doesn't support setting the socket in that manner. You would either need to use to bypass the socket or manually create config.php and use ini_set to change mysqli.default_socket to point to your socket file.
  5. octabrain

    octabrain Member

    OK, that did it. Thanks a lot.

Share This Page