Kohana MySQL connection problem

William-B used Ask the Experts™
I am currently using iPage to host a site I am developing.  I am having a problem though with a connection to the MySQL server using Kohana.  I am including the error message and my current database configuration in this message.  I know it might just be a MySQL error given the error message, but I though I would include that I'm using Kohana just in case.  I have contacted iPage to ask them about it, but their customer support is abysmal at best and it seemed that they really didn't have any idea what I was talking about, although I did manage to confirm that localxingcom.ipagemysql.com was the correct server address.  Unfortunately I can't include a link to the site as it is currently password protected and under development.  I'm hoping that what I'm including will be enough information to at least steer me in the right direction.  Thanks in advance.

Kohana Error Message:

Database_Exception [ 2 ]: mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

Current database setup as contained in database.php:

return array(
    'default'           => array(
        'type'          => 'mysql',
        'connection'    => array(
            'hostname'  => 'localxingcom.ipagemysql.com',
            'username'  => 'web_connection21',
            'password'  => '*************',
            'persistent'=> FALSE,
            'database'  => 'main_table86'
        'table_prefix'  => '',
        'charset'       => 'utf8',
        'profiling'     => TRUE,
        'caching'       => FALSE
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
MurfurFull Stack Developer

That is an error being reported by the host server and would suggest that MySQL is not actually running or that it is misconfigured and therefore not visible over IP e.g. the bind-address setting in my.cnf

Can you confirm that the MySQL service is running?


I'm assuming that it is running, I can access it from iPage's MySQL web interface (mysqladmin).  I am not sure if this is related but I was trying to set up a connection to the database using MySQL Workbench which didn't work, but I was assuming that was more of a remote configuration error than a server one.  At any rate it wasn't essential, just more of a convenience, so I didn't really follow up on it.  According to the web interface:  This MySQL server has been running for 33 days, 20 hours, 6 minutes and 6 seconds. It started up on Jul 17, 2014 at 01:51 PM.
Full Stack Developer
You said earlier that you had confirmed that localxingcom.ipagemysql.com was the correct server address so it could be the user account does not have permissions as that is also restricted by source IP i.e. the IP address of the 'client' requesting to connect. Similarly the web server appears to be remote from the MySQL server so it is possible that port 3306 is blocked at the MySQL server firewall (3306 is the default and you have not specified an alternate in your connection string).

You also said that you could not make a connection within MySQL Workbench which add weight to the firewall/user theories so which is it?

Relatively easy to check the user account in the MySQLAdmin assuming you have rights to do so:
web_connection21 @ localhost and
web_connection21 @ 123.456.789.012
are effectively two separate user accounts so you need to make sure there is one for the IP address of your web server. Same goes for your workstation access through MySQL Workbench.

Of course, you could aways drop a line to the DBA and ask them if you have the correct connection details and if the ports etc. are open...


Well it would seem that the problem has resolved itself.  I checked early yesterday morning and I was getting the same error.  I tried again yesterday afternoon and, without me doing anything, the message disappeared.  Now I'm getting a message that my session is corrupt, but hopefully I can track down that problem.  Thanks for your help, I guess it's too bad that I don't actually know what was wrong, but for the information for the future - full points.
MurfurFull Stack Developer

Many thanks!

As to your session, a corrupt session suggests to me session cookies so delete them then reload the page...

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial