Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Can't connect to local MySQL server through socket '/tmp/mysql.sock'*

ansegoansego New
edited July 2012 in Vanilla 2.0 - 2.8

Hi guys,

Wondering why I am getting this fatal error: Gdn_Database.Connection(); I was not doing any configurations in the back end, the web hosting that I am using see no problems so how do I fix? Is there a patch or something? Says It cannot connect... all the settings are correct and I've logged into phpmyadmin repaired the tables and optimized them and restarted the database process. Please help!

The site is: www.minecraft.net.au/index.php

**The Full error: (Won't hold format, web link above) **

Fatal Error in Gdn_Database.Connection();

An error occurred while attempting to connect to the database
SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
The error occurred on or near: /f5/minecraft-net-au/public/library/database/class.database.php
56:             $this->_Connection = new PDO(strtolower($this->Engine) . ':' . $this->Dsn, $this->User, $this->Password, $this->ConnectionOptions);
57:             if($this->ConnectionOptions[1002])
58:                $this->Query($this->ConnectionOptions[1002]);
59:          } catch (Exception $ex) {
60:             trigger_error(ErrorMessage('An error occurred while attempting to connect to the database', $this->ClassName, 'Connection', $ex->getMessage()), E_USER_ERROR);
61:          }
62:       }
63:       
64:       return $this->_Connection;
Backtrace:
/f5/minecraft-net-au/public/library/database/class.database.phpPHP::Gdn_ErrorHandler();
[/f5/minecraft-net-au/public/library/database/class.database.php:60] PHP::trigger_error();
[/f5/minecraft-net-au/public/library/database/class.database.php:232] Gdn_Database->Connection();
[/f5/minecraft-net-au/public/library/database/class.sqldriver.php:1584] Gdn_Database->Query();
[/f5/minecraft-net-au/public/library/database/class.sqldriver.php:639] Gdn_SQLDriver->Query();
[/f5/minecraft-net-au/public/applications/dashboard/models/class.permissionmodel.php:362] Gdn_SQLDriver->Get();
[/f5/minecraft-net-au/public/applications/dashboard/models/class.permissionmodel.php:117] PermissionModel->PermissionColumns();
[/f5/minecraft-net-au/public/applications/dashboard/models/class.usermodel.php:80] PermissionModel->CachePermissions();
[/f5/minecraft-net-au/public/library/core/class.session.php:291] UserModel->DefinePermissions();
[/f5/minecraft-net-au/public/library/core/class.auth.php:27] Gdn_Session->Start();
[/f5/minecraft-net-au/public/bootstrap.php:170] Gdn_Auth->StartAuthenticator();
[/f5/minecraft-net-au/public/index.php:28] PHP::require_once();
Variables in local scope:
[ex] array (
  'errorInfo' => NULL,
)
Need Help?
If you are a user of this website, you can report this message to a website administrator.
If you are an administrator of this website, you can get help at the Vanilla Community Forums.
Additional information for support personnel:
Application: Vanilla
Application Version: 2.0.16
PHP Version: 5.2.17-nfsn2
Operating System: FreeBSD
Server Software: Apache/2.2
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11
Request Uri: /index.php
Controller: Gdn_Database
Method: Connection

Comments

  • UnderDogUnderDog MVP
    edited July 2012

    So ... focus on this error Can't connect to local MySQL server through socket '/tmp/mysql.sock' and there are a couple of threads about it on the forum.



    Keep focussing on the terms "MySQL" + "Socket" + "error" and I think you'll come op with some more threads to look at.

    If you're on a godaddy server take a look at that thread first...

    There was an error rendering this rich post.

  • I had a look at those posts, thanks, but not a great deal of help. I went into the conf/config.php and noticed the database details had not been set and everything was reset to defualt, really weird. Now I have other errors such as permissions read/write to files and stuff of the like. I also set the conf/config-defaults.php database details, hope that was meant to be set.

    Was the file library/core/class.configuration.php meant to have set paths too?

    This is weird, never used Vanilla before, normally phpbb or vbulletin, never had this happen. Just took over the site 4 weeks ago.

    Could do with some help,

    Cheers.

  • UnderDogUnderDog MVP
    edited July 2012

    ansego said:
    Just took over the site 4 weeks ago.

    I understand, no problems, there must be a solution for this somewhere...

    I went into the conf/config.php and noticed the database details had not been set and everything was reset to defualt,

    That is really really weird and your site is still running?
    Make sure you backup everything, DataBase separately from PHP files.
    is there some way you can try some things on your local computer? (localhost) After it's resolved you can apply those same steps on your host.

    Now I have other errors such as permissions read/write to files and stuff of the like.

    Yes, that's strange, because Vanilla checks on those, before installation happens (so before you took over)

    I also set the conf/config-defaults.php database details, hope that was meant to be set.

    That's ok, conf/config-defaults is meant to be used by Vanilla during installation, it copies over the defaults to conf/config.php

    Was the file library/core/class.configuration.php meant to have set paths too?

    Everything that's meant to have paths is written during install. Nothing needs to be adjusted afterwards by users, unless you run into strange situations, like this moment.
    Don't change the paths anywhere but conf/config.php.
    Let's see if you can set something up locally.

    There was an error rendering this rich post.

  • Yeah it is really weird, I have a mate looking into the back end via ssh sometime today to see what he finds, database did not seem effected other then settings ie theme, plugins etc if their links are stored in the db. My IIS is currently setup for .net, going to install php/mysql environment on it tonight and divide / conq. Could it be a DDOS attack? did we just get hacked? Well least the site is reading from db now, just need to sort out the other stuff. Never seen anything like this.

    btw Underdog, your pretty helpful and supportive, thanks mate, You want to have a look in the dashboard? signup and I'll up your perms, maybe you see something we don't.

    Re

    Ansego.

  • ansego said:
    btw Underdog, your pretty helpful and supportive, thanks mate, You want to have a look in the dashboard? signup and I'll up your perms, maybe you see something we don't.

    Sure, but I'd rather look at the backend too, once your mate is done with it :-) We have a great user living in Aussie, so maybe he can shed a light on your site too, I'll mention @422.

    PHP and MySQL on your local PC is fine, but I think that you need apache too, otherwise it's not the same setup as your server. You need to 'mimick' your server's setup as much as you can on your localhost. I always install Xampp (or Wampp) http://www.apachefriends.org/en/xampp-windows.html

    Oh, I'm rather busy for the next 2 days, so maybe after that I can take a deeper look, if you haven't figured out a proper solution by then :-)

    There was an error rendering this rich post.

  • Whats the secure / best way to send you login details?

  • Details sent mate, thanks.

  • All fixed, perms were the 2nd error, don't know what rolled the site to start with tho... really weird, cheers mate, your a great asset to vanilla forums.

Sign In or Register to comment.