ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)

Note: For MySQL 5.7+, please see the [answer from Lahiru] to this question. That contains more current information.

For MySQL < 5.7:

The default root password is blank (i.e., an empty string), not root. So you can just log in as:

mysql -u root

You should obviously change your root password after installation:

mysqladmin -u root password [newpassword]

In most cases you should also set up individual user accounts before working extensively with the database as well.

Leave a Comment