Warning: mysql_connect(): Access denied?

_Xero_

New Member
Messages
152
Reaction score
0
Points
0
Can someone help me with some php-mysql? I keep getting this error on my page:

Warning: mysql_connect(): Access denied for user: 'xero@localhost' (Using password: NO) in /home/xero/public_html/common.php on line 5
Error! Could not connect to database: Access denied for user: 'xero@localhost' (Using password: NO)

this is the source:

$server = mysql_connect( "localhost", "xero" )
or die( "Error! Could not connect to database: " . mysql_error() );

$connect = mysql_select_db( "index", $server )
or die( "Error! Could not select the database: " . mysql_error() );
 

soten355

New Member
Messages
278
Reaction score
0
Points
0
it's better to state the full address of the mysql host, because it might be trying to connect to the x10hosting.com's mysql database.
 

Bryon

I Fix Things
Messages
8,149
Reaction score
101
Points
48
In what you supplied I can tell you one thing.

1. You aren't using a password in mysql_connect(). This may be your problem?

To what Soten355 said: You shouldn't need to worry about connecting to the wrong MySQL server if you supply "localhost" (As the parameter) as the MySQL host to connect to with mysql_connect(). If you want to though, use the IP address: 70.86.136.178

I think your problem here is with you not supplying a password? Check cPanel and update your MySQL account "xeon's" password, then add that as the third argument to mysql_connect().

Also, I'm moving this thread to a better-suited forum.
 
B

Brandon

Guest
I agree with NedreN i'm not the greatest at PHP and MySQL but the password is the problem it looks fine.
 
Top