Good day, as the pictures show, my website has the following error after an upload I did to have some changes:
500 Internal Server Error
SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: NO) (1045)
any help would be appreciated. I am guessing it has something to do with the database not connecting to the website.
I was just given this to try to work out and the db config file is:
<?php
class config_db {
public function init() {
$db = new PDO('mysql:host=localhost;dbname=mywhitecard;charset=utf8', 'root', '');
date_default_timezone_set('Hongkong');
return $db;
}
}
?>
I have access to the database but where do I know the actual username and password needed? I tried to enable each one but I get the exact same 500 Internal Server Error
UPDATE:I really dont know why access is denied where clearly it is granted here in the user accounts.
UPDATE 2: I tried to create a new database where I imported the current one and a new user with a name and password, I still get the same 500 internal server error just with the new user getting the access denied.
Create a new database. Create a new user. Copy db 'mywhitecard' into new database. Now in the configuration php file use:
$db = new PDO('mysql:host=localhost;dbname='newdb';charset=utf8', 'newuser', 'newpass');
All the best!!!
Try setting a username and password for the database. There are several different types of security (typically default) permissions that you may be running into that will disable the login without password.
I ran into a similar issue a few years ago, but I haven't used php/mysql in a few years, so this may be old/ancient advice :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.