chiprivers Posted May 19, 2012 Share Posted May 19, 2012 I have just set up MAMP on my new MacBook Pro and I am having trouble getting my MySQL connection working. When I use the following code: $mysqli = new mysqli('localhost', 'application', 'application', 'dorset'); if ($mysqli->connect_errno) { echo "Failed to connect to MySQL: (".$mysqli-errno.") ".$mysqli->connect_error; } I get this error: Failed to connect to MySQL: () Access denied for user 'application'@'localhost' (using password: YES) However if I use the old mysql_connect() function, it doesnt throw back any errors?! Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/262752-access-denied-for-user/ Share on other sites More sharing options...
trq Posted May 19, 2012 Share Posted May 19, 2012 The error is pretty self explanatory. The user "application" does not have permission to access mysql using the password "application" from localhost. Quote Link to comment https://forums.phpfreaks.com/topic/262752-access-denied-for-user/#findComment-1346718 Share on other sites More sharing options...
chiprivers Posted May 19, 2012 Author Share Posted May 19, 2012 The error is pretty self explanatory. The user "application" does not have permission to access mysql using the password "application" from localhost. It does have permission - it works when using mysql_connect() Quote Link to comment https://forums.phpfreaks.com/topic/262752-access-denied-for-user/#findComment-1346720 Share on other sites More sharing options...
PFMaBiSmAd Posted May 19, 2012 Share Posted May 19, 2012 What's the exact mysql_connect and mysql_select_db statement that does work? Quote Link to comment https://forums.phpfreaks.com/topic/262752-access-denied-for-user/#findComment-1346817 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.