How do I log in as the MySQL root user if I get an 'access denied' error 1045 message when logging in for the first time?

Updated -

After installing and starting the mysql-server package the following error message was printed to the terminal after attempting to login with this command mysql -u root -p mysql. Example:

ERROR 1045: Access denied for user: 'root@localhost' (Using password: YES)

This is because when attempting to log into the mysql-server da...

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content