dlyles Posted November 24, 2006 Share Posted November 24, 2006 Let me say that I am an extreme newbie. I usually program using ASP, however I'm on a Linux server at work now, so...I'm having a basic problem connecting to the data. The password I'm using connects me to phpmyadmin just fine. However, trying to connect using the below code gives me an access denied error.$user="root";$password="****";$dbh=mysql_connect("localhost", $user, $password);I stripped everything so I could get to the root of the problem. What is the root of the problem? Quote Link to comment Share on other sites More sharing options...
Jenk Posted November 24, 2006 Share Posted November 24, 2006 change your connection line to:[code=php:0]$dbh=mysql_connect("localhost", $user, $password) or die(mysql_error());[/code]and it will display the error message. Quote Link to comment Share on other sites More sharing options...
dlyles Posted November 24, 2006 Author Share Posted November 24, 2006 Sorry, I should've posted that earlier.Access denied for user 'root'@'localhost' (using password: YES)But, like I said, I can connect to phpmyadmin using the same username and password. Quote Link to comment Share on other sites More sharing options...
c_shelswell Posted November 24, 2006 Share Posted November 24, 2006 try omiting the password when i log on to mysql at home its not set up to have a password for the root user. I was getting the same error until i just logged on as root. Quote Link to comment Share on other sites More sharing options...
dlyles Posted November 24, 2006 Author Share Posted November 24, 2006 I did that also and got the same error message (of course with the exception of "USING PASSWORD..." Quote Link to comment Share on other sites More sharing options...
marcus Posted November 24, 2006 Share Posted November 24, 2006 Connect to the database itself.[code]$dbh = myaql_connect(host,dbuser,dbpass);$db = mysql_select_db(dbname,$dbh);[/code] Quote Link to comment Share on other sites More sharing options...
dlyles Posted November 24, 2006 Author Share Posted November 24, 2006 Tried that too :-\ 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.