xander_tan Posted May 4, 2007 Share Posted May 4, 2007 My PHP script always return me access denied 'root'@'localhost'. No matter how I put in the php script. I can use mysql from the shell but not from PHP. It just does not make any sense... I tried: - mysql_connect('localhost','root','rootpass'); - mysql_connect('localhost','admin','adminpass'); (after I add in this account) - I change my /etc/my.cnf under mysqld to OLD_PASSWORD, change all the password <and whatsoever> it still gives me access denied 'root'@'localhost' (password: NO), no matter what the user and password I put in. Anyone knows how to fix this? Quote Link to comment Share on other sites More sharing options...
eddedwards Posted May 4, 2007 Share Posted May 4, 2007 try mysql_connect('localhost','root', PASSWORD('rootpass')); i think it encondes it. i could be wrong though. Quote Link to comment Share on other sites More sharing options...
mattclements Posted January 31, 2008 Share Posted January 31, 2008 if not, your mysql user "root" may only be accessable from "localhost" rather than a PHP Script etc.. I can take a look if you need it... If not check the root user can be used by "ANY HOST" Let me know, Matt Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted January 31, 2008 Share Posted January 31, 2008 default password of mysql is null if unless you specified other so your code should be mysql_connect('localhost','root',''); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.