homepage Welcome to WebmasterWorld Guest from 54.145.183.126
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

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



 
Msg#: 4282269 posted 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#: 4282269 posted 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

WebmasterWorld Administrator phranque us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 4282269 posted 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

WebmasterWorld Senior Member rocknbil us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4282269 posted 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.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved