DarrenReeder Posted November 30, 2009 Share Posted November 30, 2009 Hello, I had my website working perfectly untill i realised i can access PHPmyadmin from anywhere, so ive added a password to XAMPP (127.0.0.1/xampp) and ive added a password for the mysql database... i have all the correct settings on my connect script.. but i get this error.. Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: NO) in C:\xampp\htdocs\SW\Soldiers Warfare\main\connection.php on line 11 it says using password: NO..but i have got a password there! Quote Link to comment https://forums.phpfreaks.com/topic/183431-connecting-to-mysql-with-a-password/ Share on other sites More sharing options...
PFMaBiSmAd Posted November 30, 2009 Share Posted November 30, 2009 It would take seeing your code in order to be able to tell you why it produced that result. Best guess is that the actual code that was executed is not the code you changed. Quote Link to comment https://forums.phpfreaks.com/topic/183431-connecting-to-mysql-with-a-password/#findComment-968214 Share on other sites More sharing options...
DarrenReeder Posted November 30, 2009 Author Share Posted November 30, 2009 hmm, well ive removed password at the moment so i can keep on making my site.... here is the connection process: $host="localhost"; $username="root"; $password=""; $db_name="site"; //connect to database mysql_connect("$host","$username","$password")or die("cannot connect to server"); mysql_select_db("$db_name")or die("cannot select Database"); If i set the phpmyadmin password as 'test'..what o i do to this code ( i asumed i put it in the password variable but its not working...) Quote Link to comment https://forums.phpfreaks.com/topic/183431-connecting-to-mysql-with-a-password/#findComment-968218 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.