Hi guys, I was following the tutorial and all was well until I refreshed the page and was not able to connect to the database the error i received was as follows:
Warning: mysql_connect(): Access denied for user 'root'@'localhost' (using password: YES) in C:\xampp\htdocs\series\die_and_exit_functions\index.php on line 13
Could not connect to database.
Tried to insert my code not sure whats up. so will just type the few lines.
mysql_connect ('localhost' . 'root' , ' ' ) || die ('Could not connect to database.');
Your assistance is appreciated
Beginner PHP Tutorial - 29 - die and exit Functions question
Post a Reply
|Oldest Newest Rating|
· April 29, 2015
1. Check out if you installed MySQL separately you need to remove it , because XAMPP will install MySQL too.
2. go to http://localhost/security/index.php and set password for your MySQL(root user)
I wish this helps you.
· April 30, 2015
Also, I'd recommend you using MySQLi since MySQL will not be supported by PHP in the future.
$conn = new mysqli('host','username','password','database');
For more information: http://www.w3schools.com/php/php_mysql_intro.asp
· April 25, 2015
It is a file, I don't remember the name of it where you setup if you are going to use password for the root access or not. In the first line you have using password: YES. In your code you have the password parameter empty
mysql_connect ('localhost' . 'root' , 'password goes here ' ) || die ('Could not connect to database.');
It is a .php file where you change that setting.
· April 25, 2015
So I went to localhost/phpmyadmin page under users and of all the users including root have No password on them. so not sure. To be clear I'm running Xampp not a live hosted version.