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.

connecting to mysql (sorry I know this is not really a cpanel question)

Discussion in 'Database Discussions' started by DWHS.net, Apr 22, 2010.

  1. DWHS.net

    DWHS.net Well-Known Member
    PartnerNOC

    Joined:
    Jul 28, 2002
    Messages:
    1,569
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    LA, Costa RIca
    cPanel Access Level:
    Root Administrator
    My customer is trying to connect to mysql and says he does it like this all the time but with cpanel it's not working. I checked and he set up the mysql username, database, password, correctly and connected the two with full privileges.

    Here is how he is trying to connect but it is not working.

    $link = mysql_connect(localhost,pochroel_admin,pochroel);
    mysql_select_db(\'pochroel_porndb\', $link);

    I have no idea about script coding and was hoping for any help on this.
     
  2. madaboutlinux

    madaboutlinux Well-Known Member

    Joined:
    Jan 24, 2005
    Messages:
    1,052
    Likes Received:
    2
    Trophy Points:
    38
    Location:
    Earth
    If you have root access to your server, SSH to your server and execute the following command:

    If it takes you to the "mysql" prompt, then the database username/password is correct and have him checked his code again.

    If it doesn't take you to the "mysql" prompt, then either the password is incorrect OR the privileges are not granted.
     
  3. mickbeng

    mickbeng Well-Known Member

    Joined:
    Oct 3, 2006
    Messages:
    56
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Penang, Malaysia
    Try to change to (with single code) if it is working.
    Code:
    $link = mysql_connect('localhost','pochroel_admin','pochroel');
    For more detail, you may refer to PHP MySQL_Connect
     
  4. DWHS.net

    DWHS.net Well-Known Member
    PartnerNOC

    Joined:
    Jul 28, 2002
    Messages:
    1,569
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    LA, Costa RIca
    cPanel Access Level:
    Root Administrator
    That's awesome, it worked!
     
Loading...

Share This Page