Access denied for user 'swhisa_swhisa'@'localhost' (using password: YES).

proudlyphp

Registered
Jul 29, 2008
2
0
51
I am a newbie for cPanel. Recently, we registered for cPanel and I am assigned to administer the web-based database management system. Since we are client to the www.cpanel.net and we get the access through the username and pasword. Once we are connected to this panel, I have access to the MySql database through the username and password using and php code. That is the process.

Below is what I have been doing. I have set privileges in the PhpMyAdmin. I have given you the php connection code. And finally I tried everything with an query string, the last php code I showed you.

Users in swhisadb
swhisa_swhisa (Privileges: ALL PRIVILEGES)

And again I wrote the code inside the connecttodb.php just after connecting, as you recommended. I will show you the improved code and the new error message I got as below:

The following is the connection string.

Code: ( text )

1. <?php
2. define('MYSQL_HOST','localhost');
3. define('MYSQL_USER','swhisa_swhisa');
4. define('MYSQL_PASS','#nd3R');
5. define('MYSQL_DB','swhisa_swhisadb');
6. if(!mysql_connect (MYSQL_HOST, MYSQL_USER, MYSQL_PASS)){die (mysql_error()); } mysql_select_db(MYSQL_DB);
7.
8. $grt = "GRANT ALL ON *.* TO 'swhisa_swhisa'@'%'";
9. mysql_query($grt) or die(mysql_error());
10.
11. ?>

The following is the insert query string
Code: ( text )

1.
2.
3. <?php
4. ob_start();
5.
6. include ('../common/connecttodb.php');
7. echo "Connection Successful!<br>";
8.
9. $sho = "INSERT INTO `swhisadb`.`tblsug` SET `2ma`=445";
10. mysql_query($sho) or die(mysql_error());
11.
12. header('Location:../index.php');
13.
14. ob_end_flush();
15. ?>



After all this, I have the following new error message: Access denied for user 'swhisa_swhisa'@'localhost' (using password: YES).

What is going wrong? Please help.
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,437
33
473
Go on, have a guess
It could be the hash sign in the password. This is really something you need to ask your hosting provider about, though.
 

proudlyphp

Registered
Jul 29, 2008
2
0
51
still the same problem

Thank you. As per your comment, I removed the hash sign and changed my password to nd3R123. But still the problem is the same error message as Access denied for user 'swhisa_swhisa'@'localhost' (using password: YES).

Please help
 
Last edited: