Why does thesql_secure_installation fail to permit me (as MySQL root user) to enter no password

fedoraMySQL

I'm a new Fedora user…. after using Ubuntu for more than a decade, their Eric6 implementation is, per Eric6 Support, a failure. Fedora is supposed to have it right. So, I'm testing Fedora.

I'm running Fedora 36 and have installed MySQL per the yum instructions (https://dev.mysql.com/doc/mysql-repo-excerpt/5.6/en/linux-installation-yum-repo.html). When I get to the part of running mysql_secure_installation (step 6), the first thing it asks is for a root password… which I have not set yet.

If I press enter, it stops and complains access denied: using password no. If I try to use my standard password (which, again, I have not set yet), it aborts with access denied: using password yes.

So, I go through the process of stopping the server, executing mysql without networking, so I can sneak behind and set a MySQL root password using the ALter USER statement.

Having apparent success in doing this, I continue to start MySQL server again (service mysqld start) and receive this:

Redirecting to /bin/systemctl start mysqld.service Job for
mysqld.service failed because the control process exited with error
code.

See "systemctl status mysqld.service" and "journalctl -xeu
mysqld.service" for details.

Following these directions, I get (from systemctl status mysqld.service)

× mysqld.service – MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Mon 2022-08-29 01:26:45 CDT; 3min 3s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 4521 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Process: 4558 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS (code=exited, status=1/FAILURE) Main PID: 4558 (code=exited,
status=1/FAILURE)
Status: "Server shutdown complete"
Error: 13 (Permission denied)
CPU: 3.379s

Aug 29 01:26:41 kamz-workstation systemd[1]: Starting mysqld.service –

MySQL Server… Aug 29 01:26:45 kamz-workstation systemd[1]:
mysqld.service: Main process exited, code=exited, status=1/FAILURE Aug
29 01:26:45 kamz-workstation systemd[1]: mysqld.service: Failed with
result 'exit-code'. Aug 29 01:26:45 kamz-workstation systemd[1]:
Failed to start mysqld.service – MySQL Server. Aug 29 01:26:45
kamz-workstation systemd[1]: mysqld.service: Consumed 3.379s CPU time.

and (from journalctl -xeu mysqld.service), I receive:

Aug 29 01:08:35 kamz-workstation systemd[1]: Starting mysqld.service –
MySQL Server… ░░ Subject: A start job for unit mysqld.service has
begun execution ░░ Defined-By: systemd ░░ Support:
https://lists.freedesktop.org/mailman/listinfo/systemd-devel ░░ ░░ A
start job for unit mysqld.service has begun execution. ░░ ░░ The job
identifier is 313. Aug 29 01:08:44 kamz-workstation systemd[1]:
mysqld.service: Main process exited, code=exited, status=1/FAILURE ░░
Subject: Unit process exited ░░ Defined-By: systemd ░░ Support:
https://lists.freedesktop.org/mailman/listinfo/systemd-devel ░░ ░░ An
ExecStart= process belonging to unit mysqld.service has exited. ░░ ░░
The process' exit code is 'exited' and its exit status is 1. Aug 29
01:08:44 kamz-workstation systemd[1]: mysqld.service: Failed with
result 'exit-code'. ░░ Subject: Unit failed ░░ Defined-By: systemd ░░
Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ ░░ The unit mysqld.service has entered the 'failed' state with
result 'exit-code'. Aug 29 01:08:44 kamz-workstation systemd[1]:
Failed to start mysqld.service – MySQL Server. ░░ Subject: A start job
for unit mysqld.service has failed ░░ Defined-By: systemd ░░ Support:
https://lists.freedesktop.org/mailman/listinfo/systemd-devel ░░ ░░ A
start job for unit mysqld.service has finished with a failure. ░░ ░░
The job identifier is 313 and the job result is failed. Aug 29
01:08:44 kamz-workstation systemd[1]: mysqld.service: Consumed 4.192s
CPU time. ░░ Subject: Resources consumed by unit runtime ░░
Defined-By: systemd ░░ Support:
https://lists.freedesktop.org/mailman/listinfo/systemd-devel ░░ ░░
The unit mysqld.service completed and consumed the indicated
resources. Aug 29 01:12:13 kamz-workstation systemd[1]: Starting
mysqld.service – MySQL Server… ░░ Subject: A start job for unit
mysqld.service has begun execution ░░ Defined-By: systemd ░░ Support:
https://lists.freedesktop.org/mailman/listinfo/systemd-devel ░░ ░░ A
start job for unit mysqld.service has begun execution. ░░ ░░ The job
identifier is 3201. Aug 29 01:12:16 kamz-workstation systemd[1]:
mysqld.service: Main process exited, code=exited, status=1/FAILURE ░░
Subject: Unit process exited ░░ Defined-By: systemd ░░ Support:
https://lists.freedesktop.org/mailman/listinfo/systemd-devel ░░ ░░ An
ExecStart= process belonging to unit mysqld.service has exited. ░░ ░░
The process' exit code is 'exited' and its exit status is 1. Aug 29
01:12:16 kamz-workstation systemd[1]: mysqld.service: Failed with
result 'exit-code'. ░░ Subject: Unit failed ░░ Defined-By: systemd ░░
Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ ░░ The unit mysqld.service has entered the 'failed' state with
result 'exit-code'. Aug 29 01:12:16 kamz-workstation systemd[1]:
Failed to start mysqld.service – MySQL Server. ░░ Subject: A start job
for unit mysqld.service has failed ░░ Defined-By: systemd ░░ Support:
https://lists.freedesktop.org/mailman/listinfo/systemd-devel ░░ ░░ A
start job for unit mysqld.service has finished with a failure. ░░ ░░
The job identifier is 3201 and the job result is failed. Aug 29
01:12:16 kamz-workstation systemd[1]: mysqld.service: Consumed 3.339s
CPU time. ░░ Subject: Resources consumed by unit runtime ░░
Defined-By: systemd ░░ Support:
https://lists.freedesktop.org/mailman/listinfo/systemd-devel ░░ ░░
The unit mysqld.service completed and consumed the indicated
resources. Aug 29 01:20:38 kamz-workstation systemd[1]: Starting
mysqld.service – MySQL Server… ░░ Subject: A start job for unit
mysqld.service has begun execution ░░ Defined-By: systemd ░░ Support:
https://lists.freedesktop.org/mailman/listinfo/systemd-devel ░░ ░░ A
start job for unit mysqld.service has begun execution. ░░ ░░ The job
identifier is 3420. Aug 29 01:20:42 kamz-workstation systemd[1]:
mysqld.service: Main process exited, code=exited, status=1/FAILURE ░░
Subject: Unit process exited ░░ Defined-By: systemd ░░ Support:
https://lists.freedesktop.org/mailman/listinfo/systemd-devel ░░ ░░ An
ExecStart= process belonging to unit mysqld.service has exited. ░░ ░░
The process' exit code is 'exited' and its exit status is 1. Aug 29
01:20:42 kamz-workstation systemd[1]: mysqld.service: Failed with
result 'exit-code'. ░░ Subject: Unit failed ░░ Defined-By: systemd ░░
Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ ░░ The unit mysqld.service has entered the 'failed' state with
result 'exit-code'. Aug 29 01:20:42 kamz-workstation systemd[1]:
Failed to start mysqld.service – MySQL Server. ░░ Subject: A start job
for unit mysqld.service has failed ░░ Defined-By: systemd ░░ Support:
https://lists.freedesktop.org/mailman/listinfo/systemd-devel ░░ ░░ A
start job for unit mysqld.service has finished with a failure. ░░ ░░
The job identifier is 3420 and the job result is failed. Aug 29
01:20:42 kamz-workstation systemd[1]: mysqld.service: Consumed 3.977s
CPU time. ░░ Subject: Resources consumed by unit runtime ░░
Defined-By: systemd ░░ Support:
https://lists.freedesktop.org/mailman/listinfo/systemd-devel ░░ ░░
The unit mysqld.service completed and consumed the indicated
resources. Aug 29 01:26:41 kamz-workstation systemd[1]: Starting
mysqld.service – MySQL Server… ░░ Subject: A start job for unit
mysqld.service has begun execution ░░ Defined-By: systemd ░░ Support:
https://lists.freedesktop.org/mailman/listinfo/systemd-devel ░░ ░░ A
start job for unit mysqld.service has begun execution. ░░ ░░ The job
identifier is 3644. Aug 29 01:26:45 kamz-workstation systemd[1]:
mysqld.service: Main process exited, code=exited, status=1/FAILURE ░░
Subject: Unit process exited ░░ Defined-By: systemd ░░ Support:
https://lists.freedesktop.org/mailman/listinfo/systemd-devel ░░ ░░ An
ExecStart= process belonging to unit mysqld.service has exited. ░░ ░░
The process' exit code is 'exited' and its exit status is 1. Aug 29
01:26:45 kamz-workstation systemd[1]: mysqld.service: Failed with
result 'exit-code'. ░░ Subject: Unit failed ░░ Defined-By: systemd ░░
Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ ░░ The unit mysqld.service has entered the 'failed' state with
result 'exit-code'. Aug 29 01:26:45 kamz-workstation systemd[1]:
Failed to start mysqld.service – MySQL Server. ░░ Subject: A start job
for unit mysqld.service has failed ░░ Defined-By: systemd ░░ Support:
https://lists.freedesktop.org/mailman/listinfo/systemd-devel ░░ ░░ A
start job for unit mysqld.service has finished with a failure. ░░ ░░
The job identifier is 3644 and the job result is failed. Aug 29
01:26:45 kamz-workstation systemd[1]: mysqld.service: Consumed 3.379s
CPU time. ░░ Subject: Resources consumed by unit runtime ░░
Defined-By: systemd ░░ Support:
https://lists.freedesktop.org/mailman/listinfo/systemd-devel ░░ ░░
The unit mysqld.service completed and consumed the indicated
resources.

I can read the reports over and over and nothing jumps out at me. Why does mysql_secure_installation fail me? So, I've gone from not setting a root password but mysql_secure_installation aborting because I enter no password… to setting (in behind-the-scenes manner) a root password, when I cannot get MySQL server running again.

Best Answer

While installing you have to get inside as root to fix everything first. Then you can add a user and use it with that user account.

Related Question