Forgotten MySQL root Password and Error #1045 in PHPMyAdmin
If you have forgotten your MySQL root password, you may encounter error #1045 when attempting to access PHPMyAdmin. Here's a solution to reset your password:
Steps:
mysql --help | grep -A 1 "Default options"
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
skip-grant-tables
sudo service mysql restart
mysql -u root
> FLUSH PRIVILEGES; > ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'MyNewPass';
sudo service mysql restart
Your MySQL root password is now reset. You can now log into PHPMyAdmin and access your database.
The above is the detailed content of How to Reset Your MySQL Root Password After Facing Error #1045 in PHPMyAdmin?. For more information, please follow other related articles on the PHP Chinese website!