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

WebHostPro

Well-Known Member
PartnerNOC
Jul 28, 2002
1,721
27
328
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.
 

madaboutlinux

Well-Known Member
Jan 24, 2005
1,051
2
168
Earth
If you have root access to your server, SSH to your server and execute the following command:

mysql -upochroel_admin -ppochroel pochroel_porndb
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.
 

mickbeng

Well-Known Member
Oct 3, 2006
56
0
156
Penang, Malaysia
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.
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