dean7 Posted February 16, 2009 Share Posted February 16, 2009 hi, ive only just started to do php coding but now ive came over a error i carnt seem to fix Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'10.0.0.6' (using password: NO) in /home/a4376893/public_html/dbc.php on line 3 ^^ That is what is shown when i preveiw it in a browser But this is what line 3 is: 1)<?php 2)$dbname = 'a4376893_test'; 3)$link = mysql_connect("mysql6.000webhost.com","root","") or die("Couldn't make connection."); <------ line 3 4)$db = mysql_select_db($dbname, $link) or die("Couldn't select database"); 5)?> Quote Link to comment https://forums.phpfreaks.com/topic/145383-solved-help-please/ Share on other sites More sharing options...
lostprophetpunk Posted February 16, 2009 Share Posted February 16, 2009 Change "root" to your username (if you are not the full owner of the site), and also enter a password after the root as it is just "", which means that there is no password provided to connect to the database. Quote Link to comment https://forums.phpfreaks.com/topic/145383-solved-help-please/#findComment-763228 Share on other sites More sharing options...
dean7 Posted February 16, 2009 Author Share Posted February 16, 2009 i did that now there a error saying:: Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'dean7'@'10.0.0.6' (using password: YES) in /home/a4376893/public_html/dbc.php on line 3 witch all i done was put a password and changed root to dean7. Quote Link to comment https://forums.phpfreaks.com/topic/145383-solved-help-please/#findComment-763232 Share on other sites More sharing options...
trq Posted February 16, 2009 Share Posted February 16, 2009 You might not want to post your username / passwords on the board. Anyways, the problem seems to be you have given the incorrect credentials. Are you sure your username / password are correct? Quote Link to comment https://forums.phpfreaks.com/topic/145383-solved-help-please/#findComment-763235 Share on other sites More sharing options...
printf Posted February 16, 2009 Share Posted February 16, 2009 Try leaving username = root and using your password = password! Quote Link to comment https://forums.phpfreaks.com/topic/145383-solved-help-please/#findComment-763237 Share on other sites More sharing options...
lostprophetpunk Posted February 16, 2009 Share Posted February 16, 2009 Try putting "a4376893_yourusername" for the connection username, and then your mysqlpassword. Sorry, forgot to mention in my last post not to past your password. Quote Link to comment https://forums.phpfreaks.com/topic/145383-solved-help-please/#findComment-763238 Share on other sites More sharing options...
dean7 Posted February 16, 2009 Author Share Posted February 16, 2009 Anything i change with the username bit it just chages the error now i have this error: Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'a4376893_youruse'@'10.0.0.6' (using password: YES) in /home/a4376893/public_html/dbc.php on line 3 this is the code i have. <?php $dbname = 'a4376893_test'; $link = mysql_connect("mysql6.000webhost.com","a4376893_yourusername","password") or die("Couldn't make connection."); $db = mysql_select_db($dbname, $link) or die("Couldn't select database"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/145383-solved-help-please/#findComment-763243 Share on other sites More sharing options...
trq Posted February 16, 2009 Share Posted February 16, 2009 You need to put YOUR username and passowrd in, not a value we supply you. Are you sure you are using the correct username and password? because it appears you are not. Quote Link to comment https://forums.phpfreaks.com/topic/145383-solved-help-please/#findComment-763250 Share on other sites More sharing options...
dean7 Posted February 16, 2009 Author Share Posted February 16, 2009 Yh, im using the write username and password now but the error is still the same :S Quote Link to comment https://forums.phpfreaks.com/topic/145383-solved-help-please/#findComment-763251 Share on other sites More sharing options...
trq Posted February 16, 2009 Share Posted February 16, 2009 The problem is simple. Whatever username / passowrd you are using does not have permiison to access the database server in question. Is this your local dev server or some remote host? Did you setup mysql? Quote Link to comment https://forums.phpfreaks.com/topic/145383-solved-help-please/#findComment-763254 Share on other sites More sharing options...
dean7 Posted February 16, 2009 Author Share Posted February 16, 2009 Works now Thanks Quote Link to comment https://forums.phpfreaks.com/topic/145383-solved-help-please/#findComment-763263 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.