Jump to content

[SOLVED] Access denied for user '0'@'localhost' (using password: YES)


Recommended Posts

Hello,

 

I am trying to return a set of results from a query on my database, but i get the following error message:

 

Warning: mysql_connect() [function.mysql-connect]: Access denied for user '0'@'localhost' (using password: YES) in /home/sites/globexposure.net/public_html/includes/dbinfo.php on line 2

Could not connect: Access denied for user '0'@'localhost' (using password: YES)

 

 

I suspect this means that i have not assigned the proper user privileges but i'm not sure how to check this through phpMyAdmin. Can anyone confirm this/know a solution?

 

Many thanks

The phpMyAdmin link suggests that i replace 'localhost' for 127.0.0.1 to resolve this issue, which i did and got the following error:

 

Parse error: syntax error, unexpected T_DNUMBER in /home/sites/globexposure.net/public_html/includes/dbinfo.php on line 2

 

 

My include dbinfo.php looks like this:

 

<?php
$link = mysql_connect(127.0.0.1,username,password) or die("Could not connect: " . mysql_error());
      mysql_select_db('database name') or die ("Can\'t use dbmapserver : " . mysql_error());
?>

 

Incidentally my username and database name are the same but this shouldn't cause any problems. What would you suggest?

try this

 

<?php
$link = mysql_connect("localhost","username","password") or die("Could not connect: " . mysql_error());
      mysql_select_db("database name", $link) or die ("Can\'t use dbmapserver : " . mysql_error());
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.