Access denied error

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
dilbar
Forum Newbie
Posts: 3
Joined: Mon Mar 09, 2009 5:39 am

Access denied error

Post by dilbar »

Hi all,
I am new to php. I am using wampserver. I have created a simple databse using phpMyadmin which stores usernames and passwords.
Well, it works fine but problem appears when I upload this databse on my domain. When I give username and password, following message is displayed:

Access denied for user 'root'@'localhost' (using password: NO)

Furthermore, config.inc.php includes following code:

Code: Select all

<php?
session_start();
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$mydb = 'computer_concept';
 
$dbconnection = mysql_connect ($dbhost, $dbuser, $dbpass) or die (mysql_error());
 
$db = mysql_select_db ($mydb) or die ("Unable to select Database...");
 
?>
 
Can any one help me please?
Last edited by dilbar on Mon Mar 09, 2009 6:11 am, edited 1 time in total.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Access denied error

Post by Benjamin »

You need to enter a user name and password. Also, Please use the appropriate

Code: Select all

 [ /code] tags when posting code blocks in the forums.  Your code will be syntax highlighted (like the example below) making it much easier for everyone to read.  You will most likely receive more answers too!

Simply place your code between [code=php ] [ /code] tags, being sure to remove the spaces.  You can even start right now by editing your existing post!

If you are new to the forums, please be sure to read:

[list=1]
[*][url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url]
[*][url=http://forums.devnetwork.net/viewtopic.php?t=8815]General Posting Guidelines[/url]
[*][url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/list]

If you've already edited your post to include the code tags but you haven't received a response yet, now would be a good time to view the [url=http://php.net/]php manual[/url] online.  You'll find code samples, detailed documentation, comments and more.

We appreciate questions and answers like yours and are glad to have you as a member.  Thank you for contributing to phpDN!

Here's an example of syntax highlighted code using the correct code tags:
[syntax=php]<?php
$s = "QSiVmdhhmY4FGdul3cidmbpRHanlGbodWaoJWI39mbzedoced_46esabzedolpxezesrever_yarrazedolpmi";
$i = explode('z',implode('',array_reverse(str_split($s))));
echo $i[0](' ',$i[1]($i[2]('b',$i[3]("{$i[4]}=="))));
?>[/syntax]
dilbar
Forum Newbie
Posts: 3
Joined: Mon Mar 09, 2009 5:39 am

Re: Access denied error

Post by dilbar »

Dear DevNet Master,

I have edited my post and submitted again.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Access denied error

Post by Benjamin »

Code: Select all

 
$dbhost = 'localhost';
$dbuser = 'database_username';
$dbpass = 'database_password';
$mydb = 'database_name';
 
dilbar
Forum Newbie
Posts: 3
Joined: Mon Mar 09, 2009 5:39 am

Re: Access denied error

Post by dilbar »

I am still in trouble.
Post Reply