Home >Database >Mysql Tutorial >How to Fix MySQL ERROR 1045 (28000): Access Denied for User 'root'@'localhost'?
How to Resolve "ERROR 1045 (28000)" in MySQL
During the installation of software on Ubuntu, an error message "ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)" may arise when attempting to import a database file using the following command:
mysql -uroot -proot <"Db.sql"
Cause of the Error:
This error occurs because the default root password for MySQL is empty (or blank), not root.
Solution:
To resolve the error and continue:
mysql -u root
mysqladmin -u root password [newpassword]
Navigate to the directory containing the database file and re-import it with the new password:
cd ~/Desktop/iPDC-v1.3.1/DBServer-1.1 mysql -uroot -p[newpassword] <"Db.sql"
Additional Tips:
The above is the detailed content of How to Fix MySQL ERROR 1045 (28000): Access Denied for User 'root'@'localhost'?. For more information, please follow other related articles on the PHP Chinese website!