How to reset root MySQL password on Ubuntu 18.04 Bionic Beaver Linux - LinuxConfig.org


#1
The objective is to reset lost root MySQL password on Ubuntu 18.04 Bionic Beaver Linux. The simplest approach to reset MySQL database root password is to execute mysql_secure_installation program and when prompted entering your new root MySQL password:

$ sudo mysql_secure_installation

This is a companion discussion topic for the original entry at https://linuxconfig.org/how-to-reset-root-mysql-password-on-ubuntu-18-04-bionic-beaver-linux

SOME OF THE BELOW POSTS WERE TRANSFERRED FROM LINUXCONFIG'S DISQUS COMMENTS:

#2

Wendy Sukmajaya
it works for me…
but I wonder how to change password for ‘sysop’@‘localhost’


#3

Muhammad Baiquni
Hello,

It seems not work to me. I still has this error message:

mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1698 (28000): Access denied for user 'root'@'localhost'

I have repeat your step more than twice and still I cannot login to MySQL


#4

Marlin Forbes - > Muhammad Baiquni
With mysqld running, do this:

sudo mysql_secure_installation

It will ask you for a root password and some security questions. Done.


#5

Lubos Rendek MOD -> Marlin Forbes
Hi Marlin,

Well this is a GURU solution :slight_smile: ! The article is now updated to include your suggestion. Thank you for your input.


#6

James Gonzales
You have no idea how much I appreciate this article!! I have had hell trying to reset the root password until I stumbled upon this. I am thankful for people like you and your willingness and ability to share things like this. THANK YOU VERY MUCH!!!


#7

Pablo Gadino

"SET PASSWORD..." fails: EROR 1524: plugin auth_socket is not loaded


#8

Lubos Rendek Mod -> Pablo Gadino

This seems to be a result of a resent change in mysql mechanism. Article is now updated. thank you