Starting from 10.4, mysql_secure_installation gets stuck at the very beginning of execution if the database doesn't have root@localhost and the script is executed under another superuser.
It happens because after successfully connecting under the other user, it immediately runs show create user root@localhost, gets an error, interprets it as a failure to connect, and goes into the loop asking again for a password:
mysql_secure_installation from 10.4 7f03a933, console output
|
Enter current password for root (enter for none):
|
ERROR 1133 (28000) at line 1: Can't find any matching row in the user table
|
Enter current password for root (enter for none):
|
ERROR 1133 (28000) at line 1: Can't find any matching row in the user table
|
Enter current password for root (enter for none):
|
ERROR 1133 (28000) at line 1: Can't find any matching row in the user table
|
10.4 7f03a933, general log
|
200506 21:58:39 16 Connect elenst@localhost as anonymous on
|
16 Query show create user root@localhost
|
16 Quit
|
200506 22:00:11 17 Connect elenst@localhost as anonymous on
|
17 Query show create user root@localhost
|
17 Quit
|
200506 22:00:13 18 Connect elenst@localhost as anonymous on
|
18 Query show create user root@localhost
|
Earlier it wouldn't matter much, because most of operations couldn't be performed anyway due to the non-existing owner of mysql.user. Now with the trend of allowing removal of root@localhost (MDEV-19650), it becomes an issue.
Please also note the cosmetic problems, hardcoded "root" in messages like
Enter current password for root
|
where it is really asking for a password of a user it is going to pass to MariaDB client.