jhenrichs Posted June 19, 2012 Share Posted June 19, 2012 Hello, I am VERY new to PHP but I am trying to teach myself it so excuse me if I don't make sense. What I am trying to do at the moment, is to create a website with a log-on page, so to start out with, I setup WAMP on a Windows 7 machine, I have that up and going. So my next step was logging into phpMyAdmin and creating a new database named "diode" I then proceeded to go under privlages and then created a username and password with all privlages for that database yet my php code can't access it, so I have no clue what I am doing wrong. I will post my sql connection code below as well as the error message I am getting. PHP Code $connection = mysql_connect("127.0.0.1","username","password") OR die(mysql_error()); $db_select = mysql_select_db("diode",$connection) OR die(mysql_error()); Error Message ( ! ) Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Access denied for user 'username'@'localhost' (using password: YES) in C:\wamp\www\index.php on line 3 Call Stack # Time Memory Function Location 1 0.0019 684760 {main}( ) ..\index.php:0 2 0.0019 685048 mysql_connect ( ) ..\index.php:3 Access denied for user 'username'@'localhost' (using password: YES) Any help at all would be greatly appreciated! Quote Link to comment https://forums.phpfreaks.com/topic/264448-newbie-sqlphp-linking-question/ Share on other sites More sharing options...
Jessica Posted June 19, 2012 Share Posted June 19, 2012 You probably want to change "username" to root, and "password" to "" or NULL. Typical WAMP setup for the DB is root with no password. You can also change the IP to "localhost" but that shouldn't matter. Edit: I see you say you set up a username and pass - Does the code actually have them or do you have what you've posted here? (Don't post your username and password here regardless ) Quote Link to comment https://forums.phpfreaks.com/topic/264448-newbie-sqlphp-linking-question/#findComment-1355208 Share on other sites More sharing options...
jhenrichs Posted June 19, 2012 Author Share Posted June 19, 2012 ok, right now you are my hero!! I did set it to root and null for the password and that made it work! Granted I don't want to leave it at that because I would like it more secure, but I got the page to come up for once! But yes, my code does have the actual database username and password but permission wise I must still have something wrong but I can't find out what. Quote Link to comment https://forums.phpfreaks.com/topic/264448-newbie-sqlphp-linking-question/#findComment-1355215 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.