Click here to Skip to main content
12,240,822 members (64,797 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: PHP
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
Sarfaraz
Posted 16-Sep-12 20:43pm
Edited 17-Sep-12 0:15am
v4
Comments
Joan Murt 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.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

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
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

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
Sarfaraz
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

check the IIS setting and virtual directory permisions
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160426.1 | Last Updated 18 Sep 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100