JohnSmithers Posted February 21, 2011 Share Posted February 21, 2011 My first post in here. The issue is when I try to access my database online I get the following messages: Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'Harry'@'localhost' (using password: YES) in /data/www/vhosts/liminalradio.mobi/httpdocs/signupbasic.php on line 115 Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /data/www/vhosts/liminalradio.mobi/httpdocs/signupbasic.php on line 117 Could not connect: Access denied for user 'Harry'@'localhost' (using password: YES) (note - I also ran an alternative piece of code earlier that appeared to add user details to the database, but it wasn’t there when I looked; hence the reason I changed it for my old code that I knew worked). In phpmyadmin, "Harry" is the only name that has access to the database and the password has been double-checked. Is it my code or my server? ======================================= My code: ========================================== //connects to database $name = ($_post['username']); $password = ($_post['password']); $email = ($_post['emailaddress']); $awareness = ($_post['awareness']); if(isset($_POST['submitok'])) { //$dbhost = 'localhost'; //$dbuser = 'Harry'; //$dbpass = 'x67sfd'; //$dbname = 'CloudenRoad'; //$table = 'supporters'; $conn = mysql_connect('localhost','Harry', 'x67sfd'); mysql_select_db($dbname, $conn); if (!$conn) { die('Could not connect: ' . mysql_error()); } echo "it works again"; Quote Link to comment https://forums.phpfreaks.com/topic/228415-basic-user-registration-code-accessing-database-access-denied-for/ Share on other sites More sharing options...
PFMaBiSmAd Posted February 21, 2011 Share Posted February 21, 2011 Is 'localhost' the correct hostname for the database server that your database is on? Does your web host require that you prepend your hosting account name to the database username? Quote Link to comment https://forums.phpfreaks.com/topic/228415-basic-user-registration-code-accessing-database-access-denied-for/#findComment-1177772 Share on other sites More sharing options...
JohnSmithers Posted February 21, 2011 Author Share Posted February 21, 2011 Yes. 100% (confirmed). :-( Just in case - was going to check this one out later - when I first logged in to phpmyadmin I placed a random selection of letters for my blowfish secret; I've still to read up on this (to refresh me from Welling and Thomson) but is that a threat to my long-term control of the database? Will it make any difference in this case? Ignorant, but fast learner; but willing to learn hard ! Quote Link to comment https://forums.phpfreaks.com/topic/228415-basic-user-registration-code-accessing-database-access-denied-for/#findComment-1177803 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.