Kohana MySQL connection problem

Posted on 2014-08-19
Last Modified: 2014-08-21
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 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'  => '',
            'username'  => 'web_connection21',
            'password'  => '*************',
            'persistent'=> FALSE,
            'database'  => 'main_table86'
        'table_prefix'  => '',
        'charset'       => 'utf8',
        'profiling'     => TRUE,
        'caching'       => FALSE
Question by:William-B
    LVL 11

    Expert Comment

    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?

    Author Comment

    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.
    LVL 11

    Accepted Solution

    You said earlier that you had confirmed that 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...

    Author Closing Comment

    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.
    LVL 11

    Expert Comment

    Many thanks!

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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
    Creating and Managing Databases with phpMyAdmin in cPanel.
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    The viewer will learn how to count occurrences of each item in an array.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now