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!

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

Discussion in 'Database Discussion' started by WebHostPro, Apr 22, 2010.

  1. WebHostPro

    WebHostPro Well-Known Member
    PartnerNOC

    Joined:
    Jul 28, 2002
    Messages:
    1,651
    Likes Received:
    15
    Trophy Points:
    318
    Location:
    LA, Costa RIca
    cPanel Access Level:
    Root Administrator
    Twitter:
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. madaboutlinux

    madaboutlinux Well-Known Member

    Joined:
    Jan 24, 2005
    Messages:
    1,051
    Likes Received:
    2
    Trophy Points:
    168
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. mickbeng

    mickbeng Well-Known Member

    Joined:
    Oct 3, 2006
    Messages:
    56
    Likes Received:
    0
    Trophy Points:
    156
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. WebHostPro

    WebHostPro Well-Known Member
    PartnerNOC

    Joined:
    Jul 28, 2002
    Messages:
    1,651
    Likes Received:
    15
    Trophy Points:
    318
    Location:
    LA, Costa RIca
    cPanel Access Level:
    Root Administrator
    Twitter:
    That's awesome, it worked!
     
    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