Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Can't connect to local MySQL server through socket

Discussion in 'Database Discussion' started by zille, Apr 26, 2014.

  1. zille

    zille Registered

    Joined:
    Apr 26, 2014
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Hi,
    I have databasemanager.php with following code:

    PHP:
    <?php
        
        
    class databaseManager{
            
            public function 
    connectMySQL(){
                
                
    mysql_connect('walcton.db.9332569.domain.com''pankin''palki123@#')or die(mysql_error());
                
    mysql_select_db('walcton')or die(mysql_error());
                
            }
    //end function
            
        
    }//end class
        
    ?>
    The website works fine.
    The admin has dbconnection.php with following code: (error in line 9 and 12)
    PHP:
    <?php

    function db_connect() 
    {
        global 
    $host,$user,$pwd,$errstr,$sys_dbname,$port,$bSubqueriesSupported,$cMySQLNames;
        
    $strhost=$host;
        if(
    $port && $port!=3306)
            
    $strhost=$strhost.":".$port;
        
    $conn mysql_connect($strhost,$user,$pwd);
        if (!
    $conn || !mysql_select_db($sys_dbname,$conn)) 
        {
          
    trigger_error(mysql_error(), E_USER_ERROR);
        }
        
    $mysqlversion "4";
    Can anyone let me know what is wrong with the dbconnection.php setting
    Error I get when accessing admin is:

    Code:
    Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /home/content/99/2893748/html/pankin/admin/include/dbconnection.php on line 9
    
    Fatal error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /home/content/99/2893748/html/pankin/admin/include/dbconnection.php on line 12
     
  2. samachosting

    samachosting Member

    Joined:
    Apr 25, 2014
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Can you confirm whether mysql server is running in your server ?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. zille

    zille Registered

    Joined:
    Apr 26, 2014
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    No its running on ipage hosting server.
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,660
    Likes Received:
    1,787
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Do you have root access to this server? If not, have you consulted with your web hosting company regarding this issue?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice