Click here to Skip to main content
15,881,715 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear all
My name is Sarfaraz. I have created a small website for learning purpose only.
I have developed it in PHP and Mysql. The site is working fine on local server with My sql database. The sign up, Login pages are working just fine.
But when i am uploading the site on my hosting server all pages are working but pages having MYsql connectivity is displaying errors.
The actual Error is

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: NO) in /home/jahanina/public_html/sign_up.php on line 48
Access denied for user 'root'@'localhost' (using password: NO)

Actually I need the correct method to use username/ passsword and database in PHp and Mysql on hosting server.

Thank you
Updated 16-Sep-12 23:15pm
Joan M 17-Sep-12 1:57am    
Have you configured the server's database? Have you uploaded the database structure and contents to the server?
Sandeep Mewara 17-Sep-12 1:58am    
What error. You should share every bit of detail related to problem when you seek for help. It saves time and you get closest possible resolution.

Typically you will not be able to use "root" as the login user for your site neither web.
If the server is placed in another company typically they will want to control their computer and be able to do maintenance tasks there.

Speak with your hosting company, they will give you the username and password you need to use for the database or how to change it.

If you've uploaded the database structure and data into your remote server you should have the username and password for it. Use those connection details and try it again.

Good luck.
Share this answer
after you hosted you will get username and password from hosting company you should use that for your server page where you written your database connectivity code and you should must have some password
Share this answer
Goto Mysql database in your cpanel.
Create database
add anew user and password
add user to database
Give privileges to the user
Make changes

Now open your php page where the database connectivity is then replace username and password with the username and password you created in cpanel.
Type name of database as you created e.g yourhost_abc.

Now test your page it will work just fine.

Good luck
Share this answer
check the IIS setting and virtual directory permisions
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900