I am getting the following error when I tried to connect to the database. Can any one help to resolve this problem.
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'abc'@'rxsxllxr12.zzzzz.net' (using password: YES) in /home/abcd/public_html/Invoicesystem/includes/class.DBcore.php on line 62
Error in Query Execution.Error : Unable to Connect the Server216.120.228.13
MySQL Error: 1045 (Access denied for user 'abcd'@'rxsxllxr12.zzzzz.net' (using password: YES))

Recommended Answers

All 11 Replies

It means that php cannot establish a connection with mysql. I see your using mysql remotely so make sure you enabled remote mysql on the server your connecting to. And in this configuration you will need to allow the remote domain + subdomain. Then make sure your username and password is correct.

Thank you for your reply.
How to enable mysql remotely. I have one option in my control panel called remote mysql. In that I have entered my domain name.
my username and password i have given correctly.

Thankin you in advance for your reply.

Well it is hard to explain but an example will do. Say site1 has your script and mysql is on site2. In the site2 cpanel you need to click the remote mysql section then there will be a new page. In that page you enter site1. So say your script on site1 was located at http://sub.site1.com/folder/index.php then first you would enter the string "site1.com" without the quotes into the add host box and press the add host button. Then when that is added you will then need to again add another one called "%.site1.com" and submit it without the quotes. However replace site1.com with your real domain of site1 in this example. Then your script should work.

Also could I see what your mysql connect function looks like with only the username and password blanked out (so the host is still there).

Thanx a ton for your patience and replies. Thank you, I will try to remove my host ip from our thread.
I have added my domain name in my remote sql xxxx.com.% and also %.xxxx.com
still the same error persisting.
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'abc'@'rxsxllxr12.zzzzz.net' (using password: YES) in /home/abcd/public_html/Invoicesystem/includes/class.DBcore.php on line 62
Error in Query Execution.Error : Unable to Connect the Server216.120.228.13
MySQL Error: 1045 (Access denied for user 'abcd'@'rxsxllxr12.zzzzz.net' (using password: YES))
MySQL Error: 1045 (Access denied for user 'abc'@'rxsxllxr12.zzzzz.net' (using password: YES))

xxxx.com.% and also %.xxxx.com

That is meant to be
xxxx.com and also %.xxxx.com
Then replace xxxx.com with your domain name or is that your domain name?
If you could, post the domain your script is at the the domain your sql server is at (mark which is which) and I can give you the appropriate hostname for mysql_connect() and the exact strings to enter into remote sql.

Thank you again.

I typed in our thread xxxx.com actually I have given my domain name there. You can consider xxxx replaced actually with my domain name. - These lines I have added my remote sql.

And I have written the following coding in connection file.
<?php
error_reporting(15);
define("DB_DEBUG", true);
define("DEBUG", true);
$DB_DIE_ON_FAIL = true;
// database parameters
$db_conn_vars = array
(

"dbhost" => "xxx.xxx.xxx.xx",
"dbuser" => "xxx_iii",
"dbpass" => "iii_999",
"dbname" => "xxx_ii"
);
$wwwroot="http://".$_SERVER."/WAXY";
require_once("class.CommonFunc.php"); // common functions
require_once("functions.php"); // functions
$db = new CommonFunc();
?>

And so xxxx.com is the domain that your above script is hosted on? What is the other primary domain for the other server?

There is no other server. Only one domain am having and in that control panel I have added all these along with my PHP coding files.

I have developed coding files using PHP 4.3 version but the server PHP version is 5.2.10. Is this will be a concern also?

There is no other server. Only one domain am having and in that control panel I have added all these along with my PHP coding files.

I have developed coding files using PHP 4.3 version but the server PHP version is 5.2.10. Is this will be a concern also?

I thought you meant you had 2 servers and you wanted to retrieve mysql data from sever 1 to server 2. If it is just the one server then make your host name "localhost" and you should be able to delete all of those remote hosts you added.

initially i have not added anything on my remote sql then the same error was giving. now also the same error persisting.
what about php version change, will that be a concern?
to give you brief history about this problem, earlier i my site was hosted in another domain. recently i have changed the domain to new server. then this problem started persisting.

Changing from php4 to php5 or from php5 to php4 will make a big compatibility difference for mysql as from my understanding the syntax is very different (Only 70% sure). If you are using php5 to connect to a database the following is what the connection code should look like:

<?php
mysql_connect('localhost','user','password');
mysql_select_db('my_database_name');

If however you are using php4 I am not sure exactly how to do it.
Hope that code helps though as using the core code is better than using a class.
Also, you should be able to get you php version with the following code:

<?php phpinfo(); ?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.