homepage Welcome to WebmasterWorld Guest from 54.205.59.78
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Accredited PayPal World Seller

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderators: physics

Databases Forum

    
Cannot connect to mySQL database. Access denied error
Cannot, connect ,to, mySQL ,database, Access, denied ,error
tx9271




msg:4282271
 2:31 am on Mar 16, 2011 (gmt 0)

I cannot connect to my database and I am unsure as to why.
Hear is the error message:

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'tx9271_admin'@'localhost' (using password: NO) in /home/tx9271/public_html/downfeed.com/config.php on line 5
I cannot connect to the database because: Access denied for user 'tx9271_admin'@'localhost' (using password: NO)


Here is the config.php file it is referring to:


<?php
$dbname="tx9271_users";
$host="localhost";
$user="tx9271_admin";
$dbh=mysql_connect ($host,$user,"") or die ('I cannot connect to the database because: ' . mysql_error(). '');
mysql_select_db ("$dbname") or die('I cannot select the database because: ' . mysql_error());

?>



my webhost is hostgator.com. I created the database tx9271_users and created a user in that database called tx9271_admin. If anyone knows what is wrong I would greatly appreciate some help.

Thanks,
tx9271

 

zimurgy




msg:4298768
 5:04 am on Apr 16, 2011 (gmt 0)

Have you tried adding a password to your user? You could also run these sql commands to make sure your user is set up properly with the way you have it configured.

SET PASSWORD FOR 'tx9271_admin'@'localhost' = '';
GRANT ALL PRIVILEGES ON `tx9271_users` . * TO 'tx9271_admin'@'localhost';

Z

phranque




msg:4298854
 10:51 am on Apr 16, 2011 (gmt 0)

typically after granting privileges to a new user you will also have to "mysqladmin reload".

rocknbil




msg:4299924
 5:04 pm on Apr 18, 2011 (gmt 0)

It's highly unlikely most installations allow you to connect with an empty password. If they do, it's highly insecure.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved