How to find out the mysql root password

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 <span class="hljs-operator">-</span>u root <span class="hljs-operator">-</span>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


 <span class="hljs-keyword">ALTER</span> <span class="hljs-keyword">USER</span> <span class="hljs-string">'root'</span>@<span class="hljs-string">'localhost'</span> IDENTIFIED <span class="hljs-keyword">WITH</span> mysql_native_password <span class="hljs-keyword">BY</span> <span class="hljs-string">'Password you want to use'</span>;

Tulisan Lain   Update Firefox 3.0 ke 3.1 (shiretoko)

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *