Connect to MySQL-database.

Status
Not open for further replies.

rimbah

New Member
Messages
2
Reaction score
0
Points
0
Hello,

I'm trying to connect to my database but without succes. I always get this error:

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'XXX'@'starka.x10hosting.com' (using password: YES) in /home/xxx/config.php on line 10


I don't know what I'm doing wrong. This is my code:

PHP:
<?php
error_reporting(E_ALL & ~E_NOTICE); 

# CONFIG
$dbhost = '*******.x10hosting.com';
$dbuser = 'rimbah_*****';
$dbpass = '*******';

# CONNECT
$conn = mysql_connect($dbhost,$dbuser,$dbpass) or die(mysql_error());
$dbname = 'rimbah_******';
mysql_select_db('rimbah_******') or die('MySQL_select_db error.');

?>

For the host I use the main domain (when you log in cpanel, it's in the list). As user I create a user with Mysql Database and I link it to my database. As database I use the name of my database.

I know this is a very stupid question, but I can't get it to work.
Please help me.

Rimbah
 

leafypiggy

Manager of Pens and Office Supplies
Staff member
Messages
3,818
Reaction score
163
Points
63
Try using localhost as the dbhost variable.

That's what is used here.
 

rimbah

New Member
Messages
2
Reaction score
0
Points
0
Thank you, that was the problem.
I knew that it was something stupidç!
 
Status
Not open for further replies.
Top