How can I exit from mysql_secure_installation?

Viewed 4383

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.

3 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 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

ctrl+c will work, but only at the following position:

Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) :

very easy, just type ctrl+c it worked for me, don't know about you

Related