Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I exit from mysql_secure_installation?

Screenshot of the installation process

As you can see at the image (link above) I started an installation of mysql by typing

mysql_secure_installation

on the Ubuntu 20.04 terminal.

But now I just want to cancel (exit) the installation. The process is now in the password setting section (like in the image above).

I tried ctrl+x, ctrl+q, ctrl+d, ESC but none of them worked.

Should I just close the terminal window? (I want that nothing will be saved of the process)

I'm waiting for your help, thanks in advance.

like image 519
Memin Avatar asked Dec 20 '25 11:12

Memin


1 Answers

The Solution

From another terminal:

sudo kill $(ps aux | grep mysql_secure_installation | grep -v grep | awk '{print $2}')

Per qt-x's comment, if your system supports pgrep you can use:

sudo kill $(pgrep mysql_secure_installation)

You can then run 'mysql_secure_installation' again. But you may want to read the "Why I Know This" section below first....., which may explain why you have to exit 'mysql_secure_installation' in the first place [for some people].

Why I Know This

For some reason, recently I've had to set my root password first before running this script:

> mysql
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password by 'mynewpassword';

Or I end up in an endless loop where I can't set the password, and the message is:

Failed! Error: SET PASSWORD has no significance for user ‘root’@’localhost’ as the authentication method used doesn’t store authentication data in the MySQL server
like image 186
Bret Weinraub Avatar answered Dec 23 '25 02:12

Bret Weinraub



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!