Skip to:
Content
Pages
Categories
Search
Top
Bottom

mysql_connect() can’t connect through socket


  • PJ Brunet
    Participant

    @knowingart_com

    I’m on Media Temple, installing the alpha, I have the correct database name, username and password, here’s the error:

    Warning: mysql_connect() [function.mysql-connect]: Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2) in /nfs/c02/h04/mnt/41093/domains/satnightspecials.com/html/bb-includes/backpress/class.bpdb.php on line 123

    Warning: mysql_connect() [function.mysql-connect]: Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2) in /nfs/c02/h04/mnt/41093/domains/satnightspecials.com/html/bb-includes/backpress/class.bpdb.php on line 123

    Warning: Cannot modify header information – headers already sent by (output started at /nfs/c02/h04/mnt/41093/domains/satnightspecials.com/html/bb-includes/backpress/class.bpdb.php:123) in /nfs/c02/h04/mnt/41093/domains/satnightspecials.com/html/bb-includes/functions.bb-core.php on line

    I solved this by editing that line 123. Go to MT’s “Server Guide: Overview” page and copy the “Internal Hostname” under the “Database” subheading, then edit line 123 to look something like this:

    $this->dbh = mysql_connect(“internal-db.s41093.gridserver.com”, $user, $password, true);

    Worked for me.

Viewing 3 replies - 1 through 3 (of 3 total)

  • chrishajer
    Participant

    @chrishajer

    Why didn’t you set a host name when installing? It’s on the same page as the database name, username and password, it’s just not shown by default. I think it’s a link that says something like “show advanced database settings.” I wouldn’t modify the core at all to connect to the database.

    The error comes from not having a host name and the software trying to connect to localhost via port 3306, but that’s not where your database lives, it’s on a machine called internal-db.s41093.gridserver.com.


    chrishajer
    Participant

    @chrishajer

    Also, looking at the path to the files, it appears they are using NFS which has generally poor performance (SLOW) for software like bbPress and WordPress.

    https://bbpress.org/forums/topic/bbpress-is-slow-like-godaddy-says#post-21750


    PJ Brunet
    Participant

    @knowingart_com

    Honestly, I looked at the advanced options, if the “localhost” setting was there I brain-farted (after 3am) or didn’t make the connection in my head. But if you’re saying it’s there, that’s obviously the more poetic solution ;-)

    Not sure I can do anything about the NFS. I’m pleased with WP performance on MT. Looking at my GPU usage (their internal metric) I’m pretty sure I can pull off a million pageviews/month on the basic (gs) “grid service” account. With a typical shared hosting account, you’ll probably get kicked to the curb at 10k pageviews/day.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar