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.

Lost connection to MySQL server at 'reading initial communication packet'

Discussion in 'General Discussion' started by StealthParanoia, Mar 5, 2013.

  1. StealthParanoia

    StealthParanoia Registered

    Joined:
    Mar 5, 2013
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    I have created some PHP webpages for my friend using my localhost/ and gave them to him to upload his server.

    After guessing the server that we had to connect to, we ran into some problems. Now, he is too shy to post on here and I'm bored of waiting for him to contact somebody so I'm doing it myself.

    I have written the code as mysql_connect("liberty.xssl.net:2083", "usernamex", "passwordx") or die(mysql_error());
    mysql_select_db("databasex") or die(mysql_error());

    But this returns the error "Lost connection to MySQL server at 'reading initial communication packet', system error: 0".

    Have I put the wrong host name in where it says "liberty.xssl.net:2083"? If so, what should I have put in?

    Thanks,

    ~Finchyy

    P.S. Where it says "usernamex", "passwordx" and "databasex" is where his actual username, password and database name is.
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,450
    Likes Received:
    195
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Try replacing that with:
    localhost
     
  3. StealthParanoia

    StealthParanoia Registered

    Joined:
    Mar 5, 2013
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Would that work on a server..? I know that that would work on your local machine but...
     
  4. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,450
    Likes Received:
    195
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Try it and see, let us know how it goes. ;)
     
  5. quietFinn

    quietFinn Well-Known Member

    Joined:
    Feb 4, 2006
    Messages:
    998
    Likes Received:
    10
    Trophy Points:
    18
    Location:
    Finland
    cPanel Access Level:
    Root Administrator
    If the PHP application and mySQL are running in the same server then you can use "localhost".
     
  6. Jben Kaye

    Jben Kaye Registered

    Joined:
    Oct 29, 2013
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    hi I have the same problem i tried replacing the hostname to localhost but it gave me this error Access denied for user 'amadeus@birdieon'@'localhost' (using password: YES). How can i solve this one? thanks
     
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    It looks like you may not be using a valid format for your MySQL username. Check to make sure you enter the database username exactly as it appears in cPanel.

    Thank you.
     
Loading...

Share This Page