Friday, January 30, 2026

How to find out the mysql root password

Published on January 16, 2024 0 Comments
One thing that tripped me up on a new install of MySQL and wondering why I couldn't get the default password to work and why even the reset methods where not working. Well turns out that on Ubuntu 18 the most recent version of MySQL server does not use password auth at all for the root user by default. So this means it doesn't matter what you set it to, it won't let you use it. It's expecting you to login from a privileged socket.
mysql -u root -p
This will not work, even if you are using the correct password. Instead, you need to use:
sudo mysql
that will work with out any password. then once you in you need type in
 ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Password you want to use';

Related Articles

Comments (0)

No comments yet. Be the first to comment!

Leave a Comment