MySQL-CGI Access denied for user: 'user@localhost'

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():<br /> Access denied for user: 'user@localhost' to database 'dbname'<br />('user' and 'dbname' not the real ones).<br />I believe this error message means that the user and password is correct.<br /><br />Sample code:<br /> my $db = 'DBI:mysql:dbname:localhost';<br /> my $dbh = DBI->connect($db, 'user', 'password');<br /><br />Any advice?<!--content-->
Did you use 'user' and 'database' or 'tchaccountname_user' and 'tchaccountname_database'?<!--content-->
Thanks for your response. Indeed, I did specify the account name as you suggest.<br /><br />my $db = 'DBI:mysql:pphoa_database:localhost';<br />my $pass = 'this is not the real password';<br />my $dbh = DBI->connect($db, 'pphoa_user', $pass) || print "$DBI::errstr";<br /><br />And I get when viewing the page:<br />Access denied for user: 'pphoa_user@localhost' to database 'pphoa_database'<br /><br />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.<!--content-->
And you have explicitly given the username access to the database? CPanel doesn't set that up by default. Trips me up sometimes. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
(I am the same person as pphoa)<br /><br />"And you have explicitly given the username access to the database?"<br /><br />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! <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> <br /><br />Thanks for your help! Sorry if I wasted your time if I led you to believe I was knowledgeable.<!--content-->
No time was wasted. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> I'm glad I could help.<br /><br />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.<!--content-->
 
Back
Top