The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Can't connect to local MySQL server through socket

Discussion in 'Database Discussions' 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 ?
     
  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:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    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.
     
Loading...

Share This Page