If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > DBI connect failed: Access denied for user

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-30-09, 08:54
karasm karasm is offline
Registered User
 
Join Date: Jun 2009
Posts: 4
DBI connect failed: Access denied for user

I have a server running the following:

- Red Hat Enterprise Linux ES release 4
- MySQL-server-community-5.1.34-0.rhel4
- perl-5.8.5-36.el4_6.3

A week or so ago someone restarted the server for updates, and when it came back up, I was testing my scripts, and I get the following error:

'DBI connect failed: .... Access denied for user'

I am able to connect to the mysql server via command line, but I am unable to run the scripts via command line or through the web browser. Before the server was restarted everything was working correctly.

Any suggestions/ideas?

Thanks,
Matt
Reply With Quote
  #2 (permalink)  
Old 06-30-09, 09:00
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,246
it sounds to me that as part of the update your network trolls tinkered with the permissions.

check the permissions for the specified user(s)
you may need to GRANT permissions to users

if you prefer you may find it easier to use MySQL Administrator (available as part of the gui tools from MySQL) to set permissions
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #3 (permalink)  
Old 06-30-09, 09:18
karasm karasm is offline
Registered User
 
Join Date: Jun 2009
Posts: 4
When I change the host from 'servername' to 'localhost' the script works correctly via the command line, with the same username/password.

The user has permission to connect to the db through localhost, servername, and 127.0.0.1

I even tried re-creating th users:

mysql> GRANT ALL PRIVILEGES ON on database.* to 'user'@'server' IDENTIFIED BY 'password';
mysql> FLUSH PRIVILEGES;

Still no luck.
Reply With Quote
  #4 (permalink)  
Old 06-30-09, 09:30
karasm karasm is offline
Registered User
 
Join Date: Jun 2009
Posts: 4
After flusinging the privileges when i re-created the user, I am getting this now:

'Host 'servername' is not allowed to connect to this MySQL server...'

I have tried setting the username/password to both root and the other username. Both have permissions to connect to the MySQL server at servername, localhost, 127.0.0.1
Reply With Quote
  #5 (permalink)  
Old 06-30-09, 09:46
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,246
GRANTing permissions at the command line seems a klunky way of doing things. On the rare times I have to set up user accounts on MySQL lI tend to use MySQL Adminstrator, which szeems far easier and less prone to error for me
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #6 (permalink)  
Old 06-30-09, 13:01
karasm karasm is offline
Registered User
 
Join Date: Jun 2009
Posts: 4
I changed the hostname in the script to the IP of the server and now it works. I am still wondering why the actual hostname doesn't work.
Reply With Quote
  #7 (permalink)  
Old 06-30-09, 13:46
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,246
captialisation?
spelling
hidden symbols
spaces
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On