Jump to content

Connecting to Mysql With a password....


DarrenReeder

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/183431-connecting-to-mysql-with-a-password/
Share on other sites

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...)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.