Jump to content

Recommended Posts

Posted

I have a simple perl CGI script which uses the DBI module and tries to connect to my first-ever MySQL database, but I get this error from connect():

Access denied for user: 'user@localhost' to database 'dbname'

('user' and 'dbname' not the real ones).

I believe this error message means that the user and password is correct.

 

Sample code:

my $db = 'DBI:mysql:dbname:localhost';

my $dbh = DBI->connect($db, 'user', 'password');

 

Any advice?

Posted

Thanks for your response. Indeed, I did specify the account name as you suggest.

 

my $db = 'DBI:mysql:pphoa_database:localhost';

my $pass = 'this is not the real password';

my $dbh = DBI->connect($db, 'pphoa_user', $pass) || print "$DBI::errstr";

 

And I get when viewing the page:

Access denied for user: 'pphoa_user@localhost' to database 'pphoa_database'

 

I believe the user/password information is correct since if I change either of them to something stupid then I get a more obvious password verification problem.

Posted

(I am the same person as pphoa)

 

"And you have explicitly given the username access to the database?"

 

Well, I go to the "Manage Mysql" area on the cpanel, called "Sql Account Maintenance" once you get there. I see my database name and the user name. Hey, there's a "Add User to Db" button. Wouldn't you know, IT WORKS! :(

 

Thanks for your help! Sorry if I wasted your time if I led you to believe I was knowledgeable.

Posted

No time was wasted. :( I'm glad I could help.

 

I had the same problem myself when I first started here. I hadn't a clue why MT wouldn't install, until I started wandering through CPanel.

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...