'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.



Solution 1:[1]

The Solution

From another terminal:

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

You can then run it again.

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Bret Weinraub