emmons
Technical User
- Oct 9, 2002
- 114
Here is the php code:
$connect=mysql_connect("localhost:3306","root","mypassword") or die ("Error connecting to MySQL");
if ($connect){
echo "Congratulations!\n<br>";
echo "Successfully connected to MySQL database server.\n<br>";
}else{
$error = mysql_error();
echo "Could not connect to the database. Error = $error.\n<br>";
exit();
}
Here is the output
Warning: mysql_connect(): Access denied for user 'root'@'localhost' (using password: YES) in E:\webroot\mysql.php on line 8 Error connecting to MySQL
-------------------------------------
I think php is looking in the wrong directory. mysql.exe is located in e:\mysql. It seems to be looking in e:\webroot and mysql.exe is not in e:\webroot it is in e:\mysql
to connect via command line works fine
e:\mysql>mysql -u username -p
What needs to be done?
Thanks!
Kris
$connect=mysql_connect("localhost:3306","root","mypassword") or die ("Error connecting to MySQL");
if ($connect){
echo "Congratulations!\n<br>";
echo "Successfully connected to MySQL database server.\n<br>";
}else{
$error = mysql_error();
echo "Could not connect to the database. Error = $error.\n<br>";
exit();
}
Here is the output
Warning: mysql_connect(): Access denied for user 'root'@'localhost' (using password: YES) in E:\webroot\mysql.php on line 8 Error connecting to MySQL
-------------------------------------
I think php is looking in the wrong directory. mysql.exe is located in e:\mysql. It seems to be looking in e:\webroot and mysql.exe is not in e:\webroot it is in e:\mysql
to connect via command line works fine
e:\mysql>mysql -u username -p
What needs to be done?
Thanks!
Kris