MySQL fails to start on fresh install - Ubuntu 20.04

I was following this guide: How to install & setup Ghost on Ubuntu 16.04, 18.04, 20.04 or 22.04

This error is coming from the sudo apt-get install mysql-server step

Ubuntu 20.04
4G RAM
15GB Storage
2 CPUs
My VM/Container is hosted on proxmox.

Console output below:

Summary

Setting up mysql-server-8.0 (8.0.29-0ubuntu0.20.04.3) …
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Renaming removed key_buffer and myisam-recover options (if present)
mysqld will log errors to /var/log/mysql/error.log
2022-07-26T01:17:27.510592Z 0 [ERROR] [MY-010946] [Server] Failed to start mysqld daemon. Check mysqld error log.
Warning: Unable to start the server.
Created symlink /etc/systemd/system/multi-user.target.wants/mysql.service → /lib/systemd/system/mysql.service.
Job for mysql.service failed because the control process exited with error code.
See “systemctl status mysql.service” and “journalctl -xe” for details.
invoke-rc.d: initscript mysql, action “start” failed.

  • mysql.service - MySQL Community Server
    Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
    Active: activating (auto-restart) (Result: exit-code) since Tue 2022-07-26 01:17:29 UTC; 7ms ago
    Process: 17920 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
    Process: 17928 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
    Main PID: 17928 (code=exited, status=1/FAILURE)
    Status: “Server startup in progress”
    CPU: 441ms

Jul 26 01:17:29 ubuntu systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Jul 26 01:17:29 ubuntu systemd[1]: mysql.service: Failed with result ‘exit-code’.
Jul 26 01:17:29 ubuntu systemd[1]: Failed to start MySQL Community Server.
dpkg: error processing package mysql-server-8.0 (–configure):
installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1
Setting up libhttp-date-perl (6.05-1) …
Setting up libhtml-tagset-perl (3.20-4) …
Setting up liblwp-mediatypes-perl (6.04-1) …
Setting up libencode-locale-perl (1.05-1) …
Setting up libhtml-parser-perl (3.72-5) …
Setting up libhttp-message-perl (6.22-1) …
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-8.0; however:
Package mysql-server-8.0 is not configured yet.

dpkg: error processing package mysql-server (–configure):
dependency problems - leaving unconfigured
Setting up libcgi-pm-perl (4.46-1) …
Setting up libhtml-template-perl (2.97-1) …
Setting up libcgi-fast-perl (1:2.15-1) …
Processing triggers for systemd (245.4-4ubuntu3.17) …
Processing triggers for man-db (2.9.1-1) …
Processing triggers for libc-bin (2.31-0ubuntu9.9) …
Errors were encountered while processing:
mysql-server-8.0
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

Try this, which will attempt to fix missing source list and dependencies.

sudo apt update --fix-missing
sudo apt install -f

If this doesn’t work, post the output. You may also try this next. This attempts to fix broken packages.

sudo dpkg --configure -a

Once again, post the output in readable format.

Seems to have same issues, tried all the commands.

This is on a 20.04 ubuntu, 20GB HDD, 4GB RAM (It’s a different VM than last week)

E: Sub-process /usr/bin/dpkg returned an error code (1)
ghostuser@ubuntu:~$ sudo apt update --fix-missing
Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:3 http://archive.ubuntu.com/ubuntu focal-security InRelease
Reading package lists... Done
Building dependency tree       
Reading state information... Done
4 packages can be upgraded. Run 'apt list --upgradable' to see them.
ghostuser@ubuntu:~$ sudo apt install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up mysql-server-8.0 (8.0.30-0ubuntu0.20.04.2) ...
Renaming removed key_buffer and myisam-recover options (if present)
mysqld will log errors to /var/log/mysql/error.log
2022-08-02T04:26:00.390845Z 0 [ERROR] [MY-010946] [Server] Failed to start mysqld daemon. Check mysqld error log.
Warning: Unable to start the server.
apparmor_parser: Unable to replace "/usr/sbin/mysqld".  Permission denied; attempted to load a profile while confined?
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
* mysql.service - MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Tue 2022-08-02 04:26:01 UTC; 6ms ago
    Process: 28052 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
    Process: 28060 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
   Main PID: 28060 (code=exited, status=1/FAILURE)
     Status: "Server shutdown complete"
        CPU: 507ms
dpkg: error processing package mysql-server-8.0 (--configure):
 installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-8.0; however:
  Package mysql-server-8.0 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mysql-server-8.0
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
ghostuser@ubuntu:~$ sudo dpkg --configure -a
Setting up mysql-server-8.0 (8.0.30-0ubuntu0.20.04.2) ...
Renaming removed key_buffer and myisam-recover options (if present)
mysqld will log errors to /var/log/mysql/error.log
2022-08-02T04:27:15.836719Z 0 [ERROR] [MY-010946] [Server] Failed to start mysqld daemon. Check mysqld error log.
Warning: Unable to start the server.
apparmor_parser: Unable to replace "/usr/sbin/mysqld".  Permission denied; attempted to load a profile while confined?
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
* mysql.service - MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Tue 2022-08-02 04:27:17 UTC; 5ms ago
    Process: 28315 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
    Process: 28323 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
   Main PID: 28323 (code=exited, status=1/FAILURE)
     Status: "Server shutdown complete"
        CPU: 512ms

Aug 02 04:27:17 ubuntu systemd[1]: Failed to start MySQL Community Server.
dpkg: error processing package mysql-server-8.0 (--configure):
 installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-8.0; however:
  Package mysql-server-8.0 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mysql-server-8.0
 mysql-server
ghostuser@ubuntu:~$ 

Did the Ubuntu build include MariaDB?

adduser/now 3.118ubuntu5 all [installed,local]
apparmor/now 3.0.4-2ubuntu2.1 amd64 [installed,local]
apt-utils/now 2.4.6 amd64 [installed,local]
apt/now 2.4.6 amd64 [installed,local]
base-files/now 12ubuntu4.2 amd64 [installed,local]
base-passwd/now 3.5.52build1 amd64 [installed,local]
bash-completion/now 1:2.11-5ubuntu1 all [installed,local]
bash/now 5.1-6ubuntu1 amd64 [installed,local]
bind9-dnsutils/now 1:9.18.1-1ubuntu1.1 amd64 [installed,local]
bind9-host/now 1:9.18.1-1ubuntu1.1 amd64 [installed,local]
bind9-libs/now 1:9.18.1-1ubuntu1.1 amd64 [installed,local]
bsdextrautils/now 2.37.2-4ubuntu3 amd64 [installed,local]
bsdutils/now 1:2.37.2-4ubuntu3 amd64 [installed,local]
busybox-static/now 1:1.30.1-7ubuntu3 amd64 [installed,local]
ca-certificates/now 20211016 all [installed,local]
command-not-found/now 22.04.0 all [installed,local]
console-setup-linux/now 1.205ubuntu3 all [installed,local]
console-setup/now 1.205ubuntu3 all [installed,local]
coreutils/now 8.32-4.1ubuntu1 amd64 [installed,local]
cpio/now 2.13+dfsg-7 amd64 [installed,local]
cron/now 3.0pl1-137ubuntu3 amd64 [installed,local]
curl/now 7.81.0-1ubuntu1.3 amd64 [installed,local]
dash/now 0.5.11+git20210903+057cd650a4ed-3build1 amd64 [installed,local]
dbus/now 1.12.20-2ubuntu4 amd64 [installed,local]
debconf-i18n/now 1.5.79ubuntu1 all [installed,local]
debconf/now 1.5.79ubuntu1 all [installed,local]
debianutils/now 5.5-1ubuntu2 amd64 [installed,local]
diffutils/now 1:3.8-0ubuntu2 amd64 [installed,local]
distro-info-data/now 0.52ubuntu0.1 all [installed,local]
distro-info/now 1.1build1 amd64 [installed,local]
dmidecode/now 3.3-3 amd64 [installed,local]
dmsetup/now 2:1.02.175-2.1ubuntu4 amd64 [installed,local]
dosfstools/now 4.2-1build3 amd64 [installed,local]
dpkg/now 1.21.1ubuntu2.1 amd64 [installed,local]
e2fsprogs/now 1.46.5-2ubuntu1.1 amd64 [installed,local]
ed/now 1.18-1 amd64 [installed,local]
eject/now 2.37.2-4ubuntu3 amd64 [installed,local]
file/now 1:5.41-3 amd64 [installed,local]
findutils/now 4.8.0-1ubuntu3 amd64 [installed,local]
friendly-recovery/now 0.2.42 all [installed,local]
ftp/now 20210827-4build1 all [installed,local]
fuse3/now 3.10.5-1build1 amd64 [installed,local]
gcc-12-base/now 12-20220319-1ubuntu1 amd64 [installed,local]
gettext-base/now 0.21-4ubuntu4 amd64 [installed,local]
gir1.2-glib-2.0/now 1.72.0-1 amd64 [installed,local]
gpgv/now 2.2.27-3ubuntu2.1 amd64 [installed,local]
grep/now 3.7-1build1 amd64 [installed,local]
groff-base/now 1.22.4-8build1 amd64 [installed,local]
gzip/now 1.10-4ubuntu4 amd64 [installed,local]
hdparm/now 9.60+ds-1build3 amd64 [installed,local]
hostname/now 3.23ubuntu2 amd64 [installed,local]
info/now 6.8-4build1 amd64 [installed,local]
init-system-helpers/now 1.62 all [installed,local]
init/now 1.62 amd64 [installed,local]
install-info/now 6.8-4build1 amd64 [installed,local]
iproute2/now 5.15.0-1ubuntu2 amd64 [installed,local]
iptables/now 1.8.7-1ubuntu5 amd64 [installed,local]
iputils-ping/now 3:20211215-1 amd64 [installed,local]
iputils-tracepath/now 3:20211215-1 amd64 [installed,local]
irqbalance/now 1.8.0-1build1 amd64 [installed,local]
isc-dhcp-client/now 4.4.1-2.3ubuntu2.1 amd64 [installed,local]
isc-dhcp-common/now 4.4.1-2.3ubuntu2.1 amd64 [installed,local]
iso-codes/now 4.9.0-1 all [installed,local]
kbd/now 2.3.0-3ubuntu4 amd64 [installed,local]
keyboard-configuration/now 1.205ubuntu3 all [installed,local]
kmod/now 29-1ubuntu1 amd64 [installed,local]
less/now 590-1build1 amd64 [installed,local]
libacl1/now 2.3.1-1 amd64 [installed,local]
libapparmor1/now 3.0.4-2ubuntu2.1 amd64 [installed,local]
libapt-pkg6.0/now 2.4.6 amd64 [installed,local]
libargon2-1/now 0~20171227-0.3 amd64 [installed,local]
libatm1/now 1:2.5.1-4build2 amd64 [installed,local]
libattr1/now 1:2.5.1-1build1 amd64 [installed,local]
libaudit-common/now 1:3.0.7-1build1 all [installed,local]
libaudit1/now 1:3.0.7-1build1 amd64 [installed,local]
libblkid1/now 2.37.2-4ubuntu3 amd64 [installed,local]
libbpf0/now 1:0.5.0-1 amd64 [installed,local]
libbrotli1/now 1.0.9-2build6 amd64 [installed,local]
libbsd0/now 0.11.5-1 amd64 [installed,local]
libbz2-1.0/now 1.0.8-5build1 amd64 [installed,local]
libc-bin/now 2.35-0ubuntu3.1 amd64 [installed,local]
libc6/now 2.35-0ubuntu3.1 amd64 [installed,local]
libcap-ng0/now 0.7.9-2.2build3 amd64 [installed,local]
libcap2-bin/now 1:2.44-1build3 amd64 [installed,local]
libcap2/now 1:2.44-1build3 amd64 [installed,local]
libcbor0.8/now 0.8.0-2ubuntu1 amd64 [installed,local]
libcom-err2/now 1.46.5-2ubuntu1.1 amd64 [installed,local]
libcrypt1/now 1:4.4.27-1 amd64 [installed,local]
libcryptsetup12/now 2:2.4.3-1ubuntu1 amd64 [installed,local]
libcurl4/now 7.81.0-1ubuntu1.3 amd64 [installed,local]
libdb5.3/now 5.3.28+dfsg1-0.8ubuntu3 amd64 [installed,local]
libdbus-1-3/now 1.12.20-2ubuntu4 amd64 [installed,local]
libdebconfclient0/now 0.261ubuntu1 amd64 [installed,local]
libdevmapper1.02.1/now 2:1.02.175-2.1ubuntu4 amd64 [installed,local]
libdns-export1110/now 1:9.11.19+dfsg-2.1ubuntu3 amd64 [installed,local]
libdrm-common/now 2.4.110-1ubuntu1 all [installed,local]
libdrm2/now 2.4.110-1ubuntu1 amd64 [installed,local]
libedit2/now 3.1-20210910-1build1 amd64 [installed,local]
libelf1/now 0.186-1build1 amd64 [installed,local]
libestr0/now 0.1.10-2.1build3 amd64 [installed,local]
libexpat1/now 2.4.7-1 amd64 [installed,local]
libext2fs2/now 1.46.5-2ubuntu1.1 amd64 [installed,local]
libfastjson4/now 0.99.9-1build2 amd64 [installed,local]
libffi8/now 3.4.2-4 amd64 [installed,local]
libfido2-1/now 1.10.0-1 amd64 [installed,local]
libfribidi0/now 1.0.8-2ubuntu3.1 amd64 [installed,local]
libfuse3-3/now 3.10.5-1build1 amd64 [installed,local]
libgcc-s1/now 12-20220319-1ubuntu1 amd64 [installed,local]
libgcrypt20/now 1.9.4-3ubuntu3 amd64 [installed,local]
libgdbm6/now 1.23-1 amd64 [installed,local]
libgirepository-1.0-1/now 1.72.0-1 amd64 [installed,local]
libglib2.0-0/now 2.72.1-1 amd64 [installed,local]
libglib2.0-data/now 2.72.1-1 all [installed,local]
libgmp10/now 2:6.2.1+dfsg-3ubuntu1 amd64 [installed,local]
libgnutls30/now 3.7.3-4ubuntu1 amd64 [installed,local]
libgpg-error0/now 1.43-3 amd64 [installed,local]
libgssapi-krb5-2/now 1.19.2-2 amd64 [installed,local]
libhogweed6/now 3.7.3-1build2 amd64 [installed,local]
libicu70/now 70.1-2 amd64 [installed,local]
libidn2-0/now 2.3.2-2build1 amd64 [installed,local]
libip4tc2/now 1.8.7-1ubuntu5 amd64 [installed,local]
libip6tc2/now 1.8.7-1ubuntu5 amd64 [installed,local]
libisc-export1105/now 1:9.11.19+dfsg-2.1ubuntu3 amd64 [installed,local]
libjansson4/now 2.13.1-1.1build3 amd64 [installed,local]
libjson-c5/now 0.15-3~ubuntu1.22.04.1 amd64 [installed,local]
libk5crypto3/now 1.19.2-2 amd64 [installed,local]
libkeyutils1/now 1.6.1-2ubuntu3 amd64 [installed,local]
libkmod2/now 29-1ubuntu1 amd64 [installed,local]
libkrb5-3/now 1.19.2-2 amd64 [installed,local]
libkrb5support0/now 1.19.2-2 amd64 [installed,local]
libldap-2.5-0/now 2.5.12+dfsg-0ubuntu0.22.04.1 amd64 [installed,local]
libldap-common/now 2.5.12+dfsg-0ubuntu0.22.04.1 all [installed,local]
liblmdb0/now 0.9.24-1build2 amd64 [installed,local]
liblocale-gettext-perl/now 1.07-4build3 amd64 [installed,local]
liblz4-1/now 1.9.3-2build2 amd64 [installed,local]
liblzma5/now 5.2.5-2ubuntu1 amd64 [installed,local]
libmagic-mgc/now 1:5.41-3 amd64 [installed,local]
libmagic1/now 1:5.41-3 amd64 [installed,local]
libmaxminddb0/now 1.5.2-1build2 amd64 [installed,local]
libmd0/now 1.0.4-1build1 amd64 [installed,local]
libmnl0/now 1.0.4-3build2 amd64 [installed,local]
libmount1/now 2.37.2-4ubuntu3 amd64 [installed,local]
libmpdec3/now 2.5.1-2build2 amd64 [installed,local]
libncurses6/now 6.3-2 amd64 [installed,local]
libncursesw6/now 6.3-2 amd64 [installed,local]
libnetfilter-conntrack3/now 1.0.9-1 amd64 [installed,local]
libnetplan0/now 0.104-0ubuntu2.1 amd64 [installed,local]
libnettle8/now 3.7.3-1build2 amd64 [installed,local]
libnewt0.52/now 0.52.21-5ubuntu2 amd64 [installed,local]
libnfnetlink0/now 1.0.1-3build3 amd64 [installed,local]
libnftables1/now 1.0.2-1ubuntu2 amd64 [installed,local]
libnftnl11/now 1.2.1-1build1 amd64 [installed,local]
libnghttp2-14/now 1.43.0-1build3 amd64 [installed,local]
libnsl2/now 1.3.0-2build2 amd64 [installed,local]
libnss-systemd/now 249.11-0ubuntu3.4 amd64 [installed,local]
libntfs-3g89/now 1:2021.8.22-3ubuntu1.1 amd64 [installed,local]
libnuma1/now 2.0.14-3ubuntu2 amd64 [installed,local]
libp11-kit0/now 0.24.0-6build1 amd64 [installed,local]
libpam-cap/now 1:2.44-1build3 amd64 [installed,local]
libpam-modules-bin/now 1.4.0-11ubuntu2 amd64 [installed,local]
libpam-modules/now 1.4.0-11ubuntu2 amd64 [installed,local]
libpam-runtime/now 1.4.0-11ubuntu2 all [installed,local]
libpam-systemd/now 249.11-0ubuntu3.4 amd64 [installed,local]
libpam0g/now 1.4.0-11ubuntu2 amd64 [installed,local]
libparted2/now 3.4-2build1 amd64 [installed,local]
libpcap0.8/now 1.10.1-4build1 amd64 [installed,local]
libpci3/now 1:3.7.0-6 amd64 [installed,local]
libpcre2-8-0/now 10.39-3build1 amd64 [installed,local]
libpcre3/now 2:8.39-13ubuntu0.22.04.1 amd64 [installed,local]
libpipeline1/now 1.5.5-1 amd64 [installed,local]
libplymouth5/now 0.9.5+git20211018-1ubuntu3 amd64 [installed,local]
libpng16-16/now 1.6.37-3build5 amd64 [installed,local]
libpopt0/now 1.18-3build1 amd64 [installed,local]
libprocps8/now 2:3.3.17-6ubuntu2 amd64 [installed,local]
libpsl5/now 0.21.0-1.2build2 amd64 [installed,local]
libpython3-stdlib/now 3.10.4-0ubuntu2 amd64 [installed,local]
libpython3.10-minimal/now 3.10.4-3ubuntu0.1 amd64 [installed,local]
libpython3.10-stdlib/now 3.10.4-3ubuntu0.1 amd64 [installed,local]
libreadline8/now 8.1.2-1 amd64 [installed,local]
librtmp1/now 2.4+20151223.gitfa8646d.1-2build4 amd64 [installed,local]
libsasl2-2/now 2.1.27+dfsg2-3ubuntu1 amd64 [installed,local]
libsasl2-modules-db/now 2.1.27+dfsg2-3ubuntu1 amd64 [installed,local]
libseccomp2/now 2.5.3-2ubuntu2 amd64 [installed,local]
libselinux1/now 3.3-1build2 amd64 [installed,local]
libsemanage-common/now 3.3-1build2 all [installed,local]
libsemanage2/now 3.3-1build2 amd64 [installed,local]
libsepol2/now 3.3-1build1 amd64 [installed,local]
libslang2/now 2.3.2-5build4 amd64 [installed,local]
libsmartcols1/now 2.37.2-4ubuntu3 amd64 [installed,local]
libsqlite3-0/now 3.37.2-2 amd64 [installed,local]
libss2/now 1.46.5-2ubuntu1.1 amd64 [installed,local]
libssh-4/now 0.9.6-2build1 amd64 [installed,local]
libssl3/now 3.0.2-0ubuntu1.6 amd64 [installed,local]
libstdc++6/now 12-20220319-1ubuntu1 amd64 [installed,local]
libsystemd0/now 249.11-0ubuntu3.4 amd64 [installed,local]
libtasn1-6/now 4.18.0-4build1 amd64 [installed,local]
libtext-charwidth-perl/now 0.04-10build3 amd64 [installed,local]
libtext-iconv-perl/now 1.7-7build3 amd64 [installed,local]
libtext-wrapi18n-perl/now 0.06-9 all [installed,local]
libtinfo6/now 6.3-2 amd64 [installed,local]
libtirpc-common/now 1.3.2-2ubuntu0.1 all [installed,local]
libtirpc3/now 1.3.2-2ubuntu0.1 amd64 [installed,local]
libuchardet0/now 0.0.7-1build2 amd64 [installed,local]
libudev1/now 249.11-0ubuntu3.4 amd64 [installed,local]
libunistring2/now 1.0-1 amd64 [installed,local]
libunwind8/now 1.3.2-2build2 amd64 [installed,local]
libusb-1.0-0/now 2:1.0.25-1ubuntu2 amd64 [installed,local]
libuuid1/now 2.37.2-4ubuntu3 amd64 [installed,local]
libuv1/now 1.43.0-1 amd64 [installed,local]
libwrap0/now 7.6.q-31build2 amd64 [installed,local]
libx11-6/now 2:1.7.5-1 amd64 [installed,local]
libx11-data/now 2:1.7.5-1 all [installed,local]
libxau6/now 1:1.0.9-1build5 amd64 [installed,local]
libxcb1/now 1.14-3ubuntu3 amd64 [installed,local]
libxdmcp6/now 1:1.1.3-0ubuntu5 amd64 [installed,local]
libxext6/now 2:1.3.4-1build1 amd64 [installed,local]
libxml2/now 2.9.13+dfsg-1ubuntu0.1 amd64 [installed,local]
libxmuu1/now 2:1.1.3-3 amd64 [installed,local]
libxtables12/now 1.8.7-1ubuntu5 amd64 [installed,local]
libxxhash0/now 0.8.1-1 amd64 [installed,local]
libyaml-0-2/now 0.2.2-1build2 amd64 [installed,local]
libzstd1/now 1.4.8+dfsg-3build1 amd64 [installed,local]
locales/now 2.35-0ubuntu3.1 all [installed,local]
login/now 1:4.8.1-2ubuntu2 amd64 [installed,local]
logrotate/now 3.19.0-1ubuntu1.1 amd64 [installed,local]
logsave/now 1.46.5-2ubuntu1.1 amd64 [installed,local]
lsb-base/now 11.1.0ubuntu4 all [installed,local]
lsb-release/now 11.1.0ubuntu4 all [installed,local]
lshw/now 02.19.git.2021.06.19.996aaad9c7-2build1 amd64 [installed,local]
lsof/now 4.93.2+dfsg-1.1build2 amd64 [installed,local]
man-db/now 2.10.2-1 amd64 [installed,local]
manpages/now 5.10-1ubuntu1 all [installed,local]
mawk/now 1.3.4.20200120-3 amd64 [installed,local]
media-types/now 7.0.0 all [installed,local]
mount/now 2.37.2-4ubuntu3 amd64 [installed,local]
mtr-tiny/now 0.95-1 amd64 [installed,local]
nano/now 6.2-1 amd64 [installed,local]
ncurses-base/now 6.3-2 all [installed,local]
ncurses-bin/now 6.3-2 amd64 [installed,local]
netbase/now 6.3 all [installed,local]
netcat-openbsd/now 1.218-4ubuntu1 amd64 [installed,local]
netplan.io/now 0.104-0ubuntu2.1 amd64 [installed,local]
networkd-dispatcher/now 2.1-2ubuntu0.22.04.2 all [installed,local]
nftables/now 1.0.2-1ubuntu2 amd64 [installed,local]
ntfs-3g/now 1:2021.8.22-3ubuntu1.1 amd64 [installed,local]
openssh-client/now 1:8.9p1-3 amd64 [installed,local]
openssh-server/now 1:8.9p1-3 amd64 [installed,local]
openssh-sftp-server/now 1:8.9p1-3 amd64 [installed,local]
openssl/now 3.0.2-0ubuntu1.6 amd64 [installed,local]
parted/now 3.4-2build1 amd64 [installed,local]
passwd/now 1:4.8.1-2ubuntu2 amd64 [installed,local]
pci.ids/now 0.0~2022.01.22-1 all [installed,local]
pciutils/now 1:3.7.0-6 amd64 [installed,local]
perl-base/now 5.34.0-3ubuntu1 amd64 [installed,local]
postfix/now 3.6.4-1ubuntu1 amd64 [installed,local]
procps/now 2:3.3.17-6ubuntu2 amd64 [installed,local]
psmisc/now 23.4-2build3 amd64 [installed,local]
publicsuffix/now 20211207.1025-1 all [installed,local]
python-apt-common/now 2.3.0ubuntu2.1 all [installed,local]
python3-apt/now 2.3.0ubuntu2.1 amd64 [installed,local]
python3-commandnotfound/now 22.04.0 all [installed,local]
python3-dbus/now 1.2.18-3build1 amd64 [installed,local]
python3-distro-info/now 1.1build1 all [installed,local]
python3-distupgrade/now 1:22.04.10 all [installed,local]
python3-gdbm/now 3.10.4-0ubuntu1 amd64 [installed,local]
python3-gi/now 3.42.1-0ubuntu1 amd64 [installed,local]
python3-minimal/now 3.10.4-0ubuntu2 amd64 [installed,local]
python3-netifaces/now 0.11.0-1build2 amd64 [installed,local]
python3-pkg-resources/now 59.6.0-1.2 all [installed,local]
python3-update-manager/now 1:22.04.9 all [installed,local]
python3-yaml/now 5.4.1-1ubuntu1 amd64 [installed,local]
python3.10-minimal/now 3.10.4-3ubuntu0.1 amd64 [installed,local]
python3.10/now 3.10.4-3ubuntu0.1 amd64 [installed,local]
python3/now 3.10.4-0ubuntu2 amd64 [installed,local]
readline-common/now 8.1.2-1 all [installed,local]
rsync/now 3.2.3-8ubuntu3 amd64 [installed,local]
rsyslog/now 8.2112.0-2ubuntu2.2 amd64 [installed,local]
sed/now 4.8-1ubuntu2 amd64 [installed,local]
sensible-utils/now 0.0.17 all [installed,local]
shared-mime-info/now 2.1-2 amd64 [installed,local]
ssh/now 1:8.9p1-3 all [installed,local]
ssl-cert/now 1.1.2 all [installed,local]
strace/now 5.16-0ubuntu3 amd64 [installed,local]
sudo/now 1.9.9-1ubuntu2 amd64 [installed,local]
systemd-sysv/now 249.11-0ubuntu3.4 amd64 [installed,local]
systemd-timesyncd/now 249.11-0ubuntu3.4 amd64 [installed,local]
systemd/now 249.11-0ubuntu3.4 amd64 [installed,local]
sysvinit-utils/now 3.01-1ubuntu1 amd64 [installed,local]
tar/now 1.34+dfsg-1build3 amd64 [installed,local]
tcpdump/now 4.99.1-3build2 amd64 [installed,local]
telnet/now 0.17-44build1 amd64 [installed,local]
time/now 1.9-0.1build2 amd64 [installed,local]
tnftp/now 20210827-4build1 amd64 [installed,local]
tzdata/now 2022a-0ubuntu1 all [installed,local]
ubuntu-advantage-tools/now 27.9~22.04.1 amd64 [installed,local]
ubuntu-keyring/now 2021.03.26 all [installed,local]
ubuntu-minimal/now 1.481 amd64 [installed,local]
ubuntu-release-upgrader-core/now 1:22.04.10 all [installed,local]
ubuntu-standard/now 1.481 amd64 [installed,local]
ucf/now 3.0043 all [installed,local]
udev/now 249.11-0ubuntu3.4 amd64 [installed,local]
ufw/now 0.36.1-4build1 all [installed,local]
update-manager-core/now 1:22.04.9 all [installed,local]
usb.ids/now 2022.04.02-1 all [installed,local]
usbutils/now 1:014-1build1 amd64 [installed,local]
usrmerge/now 25ubuntu2 all [installed,local]
util-linux/now 2.37.2-4ubuntu3 amd64 [installed,local]
uuid-runtime/now 2.37.2-4ubuntu3 amd64 [installed,local]
vim-common/now 2:8.2.3995-1ubuntu2 all [installed,local]
vim-tiny/now 2:8.2.3995-1ubuntu2 amd64 [installed,local]
wget/now 1.21.2-2ubuntu1 amd64 [installed,local]
whiptail/now 0.52.21-5ubuntu2 amd64 [installed,local]
xauth/now 1:1.1-1build2 amd64 [installed,local]
xdg-user-dirs/now 0.17-2ubuntu4 amd64 [installed,local]
xkb-data/now 2.33-1 all [installed,local]
xxd/now 2:8.2.3995-1ubuntu2 amd64 [installed,local]
xz-utils/now 5.2.5-2ubuntu1 amd64 [installed,local]
zlib1g/now 1:1.2.11.dfsg-2ubuntu9 amd64 [installed,local]

^ apt list --installed

That’s not what I asked. Was MariaDB originally installed, i.e., did you uninstall MariaDB before installing MySQL?

I did not uninstall it, I do not believe it was installed?

It’s a fresh Ubuntu OS install

Can you temporarily turn off Apparmor, and try again.

I was having difficulty disabling it so I uninstalled it completely, same results after uninstalling and rebooting:

ghostuser@ghost-testing:~$ sudo apt-get install mysql-server
[sudo] password for ghostuser: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
mysql-server is already the newest version (8.0.30-0ubuntu0.20.04.2).
The following packages were automatically installed and are no longer required:
  python3-apparmor python3-libapparmor
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up mysql-server-8.0 (8.0.30-0ubuntu0.20.04.2) ...
Renaming removed key_buffer and myisam-recover options (if present)
mysqld will log errors to /var/log/mysql/error.log
2022-08-04T17:45:17.800495Z 0 [ERROR] [MY-010946] [Server] Failed to start mysqld daemon. Check mysqld error log.
Warning: Unable to start the server.
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
* mysql.service - MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Thu 2022-08-04 17:45:19 UTC; 6ms ago
    Process: 566 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
    Process: 574 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
   Main PID: 574 (code=exited, status=1/FAILURE)
     Status: "Server shutdown complete"
        CPU: 535ms
dpkg: error processing package mysql-server-8.0 (--configure):
 installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-8.0; however:
  Package mysql-server-8.0 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mysql-server-8.0
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
ghostuser@ghost-testing:~$ 

I assume you uninstalled Apparmor? All you had to do was stop it using systemctl.

Also, apt install mysql-server did nothing since it was already installed. You could try --reinstall or completely remove (search the forum) and install again.

Ran these for cleanup, I think this would have been sufficient
sudo apt purge mysql-server*
sudo apt-get autoremove
sudo apt-get autoclean
sudo rm /var/lib/mysql -rf

Then ran this

ghostuser@ghost-testing:~$ sudo apt-get install mysql-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libaio1 libcgi-fast-perl libcgi-pm-perl libencode-locale-perl libevent-core-2.1-7
  libevent-pthreads-2.1-7 libfcgi-perl libhtml-parser-perl libhtml-tagset-perl
  libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl
  liblwp-mediatypes-perl libmecab2 libtimedate-perl liburi-perl mecab-ipadic
  mecab-ipadic-utf8 mecab-utils mysql-client-8.0 mysql-client-core-8.0 mysql-common
  mysql-server-8.0 mysql-server-core-8.0
Suggested packages:
  libdata-dump-perl libipc-sharedcache-perl libwww-perl mailx tinyca
The following NEW packages will be installed:
  libaio1 libcgi-fast-perl libcgi-pm-perl libencode-locale-perl libevent-core-2.1-7
  libevent-pthreads-2.1-7 libfcgi-perl libhtml-parser-perl libhtml-tagset-perl
  libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl
  liblwp-mediatypes-perl libmecab2 libtimedate-perl liburi-perl mecab-ipadic
  mecab-ipadic-utf8 mecab-utils mysql-client-8.0 mysql-client-core-8.0 mysql-common
  mysql-server mysql-server-8.0 mysql-server-core-8.0
0 upgraded, 26 newly installed, 0 to remove and 4 not upgraded.
Need to get 0 B/32.1 MB of archives.
After this operation, 264 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Preconfiguring packages ...
Selecting previously unselected package mysql-common.
(Reading database ... 19444 files and directories currently installed.)
Preparing to unpack .../0-mysql-common_5.8+1.0.5ubuntu2_all.deb ...
Unpacking mysql-common (5.8+1.0.5ubuntu2) ...
Selecting previously unselected package mysql-client-core-8.0.
Preparing to unpack .../1-mysql-client-core-8.0_8.0.30-0ubuntu0.20.04.2_amd64.deb ...
Unpacking mysql-client-core-8.0 (8.0.30-0ubuntu0.20.04.2) ...
Selecting previously unselected package mysql-client-8.0.
Preparing to unpack .../2-mysql-client-8.0_8.0.30-0ubuntu0.20.04.2_amd64.deb ...
Unpacking mysql-client-8.0 (8.0.30-0ubuntu0.20.04.2) ...
Selecting previously unselected package libaio1:amd64.
Preparing to unpack .../3-libaio1_0.3.112-5_amd64.deb ...
Unpacking libaio1:amd64 (0.3.112-5) ...
Selecting previously unselected package libevent-core-2.1-7:amd64.
Preparing to unpack .../4-libevent-core-2.1-7_2.1.11-stable-1_amd64.deb ...
Unpacking libevent-core-2.1-7:amd64 (2.1.11-stable-1) ...
Selecting previously unselected package libevent-pthreads-2.1-7:amd64.
Preparing to unpack .../5-libevent-pthreads-2.1-7_2.1.11-stable-1_amd64.deb ...
Unpacking libevent-pthreads-2.1-7:amd64 (2.1.11-stable-1) ...
Selecting previously unselected package libmecab2:amd64.
Preparing to unpack .../6-libmecab2_0.996-10build1_amd64.deb ...
Unpacking libmecab2:amd64 (0.996-10build1) ...
Selecting previously unselected package mysql-server-core-8.0.
Preparing to unpack .../7-mysql-server-core-8.0_8.0.30-0ubuntu0.20.04.2_amd64.deb ...
Unpacking mysql-server-core-8.0 (8.0.30-0ubuntu0.20.04.2) ...
Setting up mysql-common (5.8+1.0.5ubuntu2) ...
update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Selecting previously unselected package mysql-server-8.0.
(Reading database ... 19665 files and directories currently installed.)
Preparing to unpack .../00-mysql-server-8.0_8.0.30-0ubuntu0.20.04.2_amd64.deb ...
Unpacking mysql-server-8.0 (8.0.30-0ubuntu0.20.04.2) ...
Selecting previously unselected package libhtml-tagset-perl.
Preparing to unpack .../01-libhtml-tagset-perl_3.20-4_all.deb ...
Unpacking libhtml-tagset-perl (3.20-4) ...
Selecting previously unselected package liburi-perl.
Preparing to unpack .../02-liburi-perl_1.76-2_all.deb ...
Unpacking liburi-perl (1.76-2) ...
Selecting previously unselected package libhtml-parser-perl.
Preparing to unpack .../03-libhtml-parser-perl_3.72-5_amd64.deb ...
Unpacking libhtml-parser-perl (3.72-5) ...
Selecting previously unselected package libcgi-pm-perl.
Preparing to unpack .../04-libcgi-pm-perl_4.46-1_all.deb ...
Unpacking libcgi-pm-perl (4.46-1) ...
Selecting previously unselected package libfcgi-perl.
Preparing to unpack .../05-libfcgi-perl_0.79-1_amd64.deb ...
Unpacking libfcgi-perl (0.79-1) ...
Selecting previously unselected package libcgi-fast-perl.
Preparing to unpack .../06-libcgi-fast-perl_1%3a2.15-1_all.deb ...
Unpacking libcgi-fast-perl (1:2.15-1) ...
Selecting previously unselected package libencode-locale-perl.
Preparing to unpack .../07-libencode-locale-perl_1.05-1_all.deb ...
Unpacking libencode-locale-perl (1.05-1) ...
Selecting previously unselected package libhtml-template-perl.
Preparing to unpack .../08-libhtml-template-perl_2.97-1_all.deb ...
Unpacking libhtml-template-perl (2.97-1) ...
Selecting previously unselected package libtimedate-perl.
Preparing to unpack .../09-libtimedate-perl_2.3200-1_all.deb ...
Unpacking libtimedate-perl (2.3200-1) ...
Selecting previously unselected package libhttp-date-perl.
Preparing to unpack .../10-libhttp-date-perl_6.05-1_all.deb ...
Unpacking libhttp-date-perl (6.05-1) ...
Selecting previously unselected package libio-html-perl.
Preparing to unpack .../11-libio-html-perl_1.001-1_all.deb ...
Unpacking libio-html-perl (1.001-1) ...
Selecting previously unselected package liblwp-mediatypes-perl.
Preparing to unpack .../12-liblwp-mediatypes-perl_6.04-1_all.deb ...
Unpacking liblwp-mediatypes-perl (6.04-1) ...
Selecting previously unselected package libhttp-message-perl.
Preparing to unpack .../13-libhttp-message-perl_6.22-1_all.deb ...
Unpacking libhttp-message-perl (6.22-1) ...
Selecting previously unselected package mecab-utils.
Preparing to unpack .../14-mecab-utils_0.996-10build1_amd64.deb ...
Unpacking mecab-utils (0.996-10build1) ...
Selecting previously unselected package mecab-ipadic.
Preparing to unpack .../15-mecab-ipadic_2.7.0-20070801+main-2.1_all.deb ...
Unpacking mecab-ipadic (2.7.0-20070801+main-2.1) ...
Selecting previously unselected package mecab-ipadic-utf8.
Preparing to unpack .../16-mecab-ipadic-utf8_2.7.0-20070801+main-2.1_all.deb ...
Unpacking mecab-ipadic-utf8 (2.7.0-20070801+main-2.1) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../17-mysql-server_8.0.30-0ubuntu0.20.04.2_all.deb ...
Unpacking mysql-server (8.0.30-0ubuntu0.20.04.2) ...
Setting up libmecab2:amd64 (0.996-10build1) ...
Setting up mysql-client-core-8.0 (8.0.30-0ubuntu0.20.04.2) ...
Setting up libhtml-tagset-perl (3.20-4) ...
Setting up liblwp-mediatypes-perl (6.04-1) ...
Setting up libencode-locale-perl (1.05-1) ...
Setting up mecab-utils (0.996-10build1) ...
Setting up libevent-core-2.1-7:amd64 (2.1.11-stable-1) ...
Setting up libio-html-perl (1.001-1) ...
Setting up libtimedate-perl (2.3200-1) ...
Setting up mysql-client-8.0 (8.0.30-0ubuntu0.20.04.2) ...
Setting up libfcgi-perl (0.79-1) ...
Setting up libaio1:amd64 (0.3.112-5) ...
Setting up liburi-perl (1.76-2) ...
Setting up libevent-pthreads-2.1-7:amd64 (2.1.11-stable-1) ...
Setting up libhttp-date-perl (6.05-1) ...
Setting up mecab-ipadic (2.7.0-20070801+main-2.1) ...
Compiling IPA dictionary for Mecab.  This takes long time...
reading /usr/share/mecab/dic/ipadic/unk.def ... 40
emitting double-array: 100% |###########################################| 
/usr/share/mecab/dic/ipadic/model.def is not found. skipped.
reading /usr/share/mecab/dic/ipadic/Verb.csv ... 130750
reading /usr/share/mecab/dic/ipadic/Noun.org.csv ... 16668
reading /usr/share/mecab/dic/ipadic/Prefix.csv ... 221
reading /usr/share/mecab/dic/ipadic/Noun.demonst.csv ... 120
reading /usr/share/mecab/dic/ipadic/Noun.adverbal.csv ... 795
reading /usr/share/mecab/dic/ipadic/Adnominal.csv ... 135
reading /usr/share/mecab/dic/ipadic/Noun.others.csv ... 151
reading /usr/share/mecab/dic/ipadic/Auxil.csv ... 199
reading /usr/share/mecab/dic/ipadic/Adverb.csv ... 3032
reading /usr/share/mecab/dic/ipadic/Interjection.csv ... 252
reading /usr/share/mecab/dic/ipadic/Others.csv ... 2
reading /usr/share/mecab/dic/ipadic/Noun.place.csv ... 72999
reading /usr/share/mecab/dic/ipadic/Noun.number.csv ... 42
reading /usr/share/mecab/dic/ipadic/Noun.adjv.csv ... 3328
reading /usr/share/mecab/dic/ipadic/Postp-col.csv ... 91
reading /usr/share/mecab/dic/ipadic/Suffix.csv ... 1393
reading /usr/share/mecab/dic/ipadic/Filler.csv ... 19
reading /usr/share/mecab/dic/ipadic/Symbol.csv ... 208
reading /usr/share/mecab/dic/ipadic/Noun.name.csv ... 34202
reading /usr/share/mecab/dic/ipadic/Noun.nai.csv ... 42
reading /usr/share/mecab/dic/ipadic/Conjunction.csv ... 171
reading /usr/share/mecab/dic/ipadic/Noun.verbal.csv ... 12146
reading /usr/share/mecab/dic/ipadic/Adj.csv ... 27210
reading /usr/share/mecab/dic/ipadic/Noun.csv ... 60477
reading /usr/share/mecab/dic/ipadic/Noun.proper.csv ... 27328
reading /usr/share/mecab/dic/ipadic/Postp.csv ... 146
emitting double-array: 100% |###########################################| 
reading /usr/share/mecab/dic/ipadic/matrix.def ... 1316x1316
emitting matrix      : 100% |###########################################| 

done!
update-alternatives: using /var/lib/mecab/dic/ipadic to provide /var/lib/mecab/dic/debian (mecab-dictionary) in auto mode
Setting up mysql-server-core-8.0 (8.0.30-0ubuntu0.20.04.2) ...
Setting up mecab-ipadic-utf8 (2.7.0-20070801+main-2.1) ...
Compiling IPA dictionary for Mecab.  This takes long time...
reading /usr/share/mecab/dic/ipadic/unk.def ... 40
emitting double-array: 100% |###########################################| 
/usr/share/mecab/dic/ipadic/model.def is not found. skipped.
reading /usr/share/mecab/dic/ipadic/Verb.csv ... 130750
reading /usr/share/mecab/dic/ipadic/Noun.org.csv ... 16668
reading /usr/share/mecab/dic/ipadic/Prefix.csv ... 221
reading /usr/share/mecab/dic/ipadic/Noun.demonst.csv ... 120
reading /usr/share/mecab/dic/ipadic/Noun.adverbal.csv ... 795
reading /usr/share/mecab/dic/ipadic/Adnominal.csv ... 135
reading /usr/share/mecab/dic/ipadic/Noun.others.csv ... 151
reading /usr/share/mecab/dic/ipadic/Auxil.csv ... 199
reading /usr/share/mecab/dic/ipadic/Adverb.csv ... 3032
reading /usr/share/mecab/dic/ipadic/Interjection.csv ... 252
reading /usr/share/mecab/dic/ipadic/Others.csv ... 2
reading /usr/share/mecab/dic/ipadic/Noun.place.csv ... 72999
reading /usr/share/mecab/dic/ipadic/Noun.number.csv ... 42
reading /usr/share/mecab/dic/ipadic/Noun.adjv.csv ... 3328
reading /usr/share/mecab/dic/ipadic/Postp-col.csv ... 91
reading /usr/share/mecab/dic/ipadic/Suffix.csv ... 1393
reading /usr/share/mecab/dic/ipadic/Filler.csv ... 19
reading /usr/share/mecab/dic/ipadic/Symbol.csv ... 208
reading /usr/share/mecab/dic/ipadic/Noun.name.csv ... 34202
reading /usr/share/mecab/dic/ipadic/Noun.nai.csv ... 42
reading /usr/share/mecab/dic/ipadic/Conjunction.csv ... 171
reading /usr/share/mecab/dic/ipadic/Noun.verbal.csv ... 12146
reading /usr/share/mecab/dic/ipadic/Adj.csv ... 27210
reading /usr/share/mecab/dic/ipadic/Noun.csv ... 60477
reading /usr/share/mecab/dic/ipadic/Noun.proper.csv ... 27328
reading /usr/share/mecab/dic/ipadic/Postp.csv ... 146
emitting double-array: 100% |###########################################| 
reading /usr/share/mecab/dic/ipadic/matrix.def ... 1316x1316
emitting matrix      : 100% |###########################################| 

done!
update-alternatives: using /var/lib/mecab/dic/ipadic-utf8 to provide /var/lib/mecab/dic/debian (mecab-dictionary) in auto mode
Setting up libhtml-parser-perl (3.72-5) ...
Setting up libhttp-message-perl (6.22-1) ...
Setting up mysql-server-8.0 (8.0.30-0ubuntu0.20.04.2) ...
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Renaming removed key_buffer and myisam-recover options (if present)
mysqld will log errors to /var/log/mysql/error.log
2022-08-05T15:04:55.884250Z 0 [ERROR] [MY-010946] [Server] Failed to start mysqld daemon. Check mysqld error log.
Warning: Unable to start the server.
Created symlink /etc/systemd/system/multi-user.target.wants/mysql.service -> /lib/systemd/system/mysql.service.
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
* mysql.service - MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Fri 2022-08-05 15:04:57 UTC; 6ms ago
    Process: 2125 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
    Process: 2133 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
   Main PID: 2133 (code=exited, status=1/FAILURE)
     Status: "Server shutdown complete"
        CPU: 570ms

Aug 05 15:04:57 ghost-testing systemd[1]: Failed to start MySQL Community Server.
dpkg: error processing package mysql-server-8.0 (--configure):
 installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1
Setting up libcgi-pm-perl (4.46-1) ...
Setting up libhtml-template-perl (2.97-1) ...
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-8.0; however:
  Package mysql-server-8.0 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Setting up libcgi-fast-perl (1:2.15-1) ...
Processing triggers for systemd (245.4-4ubuntu3.17) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.9) ...
Errors were encountered while processing:
 mysql-server-8.0
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

Check journalctl -xe and MySQL logs.

Also, when you’ve uninstalled MySQL, check using sudo dpkg -l | grep mysql, and while you’re at it sudo dpkg -l | grep mariadb. If it’s uninstalled, you’ll have a null response.

Looks like I still have some tidbits of mysql but maria is not there

ghostuser@ghost-testing:~$ sudo rm /var/lib/mysql -rf
ghostuser@ghost-testing:~$ sudo dpkg -l | grep mysql
rc  mysql-common                  5.8+1.0.5ubuntu2                  all          MySQL database common files, e.g. /etc/mysql/my.cnf
ghostuser@ghost-testing:~$ sudo dpkg -l | grep mariadb
ghostuser@ghost-testing:~$ 

Journalctl -xe:

E: Sub-process /usr/bin/dpkg returned an error code (1)
ghostuser@ghost-testing:~$ sudo journalctl -xe
Aug 08 17:27:37 ghost-testing systemd[1]: Reloading.
Aug 08 17:27:37 ghost-testing systemd[1]: Reloading.
Aug 08 17:27:37 ghost-testing systemd[1]: Reloading.
Aug 08 17:27:38 ghost-testing systemd[1]: Starting MySQL Community Server...
-- Subject: A start job for unit mysql.service has begun execution
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit mysql.service has begun execution.
-- 
-- The job identifier is 2898.
Aug 08 17:27:38 ghost-testing systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- An ExecStart= process belonging to unit mysql.service has exited.
-- 
-- The process' exit code is 'exited' and its exit status is 1.
Aug 08 17:27:38 ghost-testing systemd[1]: mysql.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- The unit mysql.service has entered the 'failed' state with result 'exit-code'.
Aug 08 17:27:38 ghost-testing systemd[1]: Failed to start MySQL Community Server.
-- Subject: A start job for unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit mysql.service has finished with a failure.
-- 
-- The job identifier is 2898 and the job result is failed.
Aug 08 17:27:39 ghost-testing systemd[1]: Reloading.
Aug 08 17:27:39 ghost-testing systemd[1]: mysql.service: Scheduled restart job, restart counter is at 1.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Automatic restarting of the unit mysql.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Aug 08 17:27:39 ghost-testing systemd[1]: Stopped MySQL Community Server.
-- Subject: A stop job for unit mysql.service has finished
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A stop job for unit mysql.service has finished.
-- 
-- The job identifier is 2949 and the job result is done.
Aug 08 17:27:39 ghost-testing systemd[1]: Starting MySQL Community Server...
-- Subject: A start job for unit mysql.service has begun execution
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit mysql.service has begun execution.
-- 
-- The job identifier is 2949.
Aug 08 17:27:39 ghost-testing sudo[3621]: pam_unix(sudo:session): session closed for user root
Aug 08 17:27:40 ghost-testing systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- An ExecStart= process belonging to unit mysql.service has exited.
-- 
-- The process' exit code is 'exited' and its exit status is 1.
Aug 08 17:27:40 ghost-testing systemd[1]: mysql.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- The unit mysql.service has entered the 'failed' state with result 'exit-code'.
Aug 08 17:27:40 ghost-testing systemd[1]: Failed to start MySQL Community Server.
-- Subject: A start job for unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit mysql.service has finished with a failure.
-- 
-- The job identifier is 2949 and the job result is failed.
Aug 08 17:27:40 ghost-testing systemd[1]: mysql.service: Scheduled restart job, restart counter is at 2.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Automatic restarting of the unit mysql.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Aug 08 17:27:40 ghost-testing systemd[1]: Stopped MySQL Community Server.
-- Subject: A stop job for unit mysql.service has finished
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A stop job for unit mysql.service has finished.
-- 
-- The job identifier is 3000 and the job result is done.
Aug 08 17:27:40 ghost-testing systemd[1]: Starting MySQL Community Server...
-- Subject: A start job for unit mysql.service has begun execution
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit mysql.service has begun execution.
-- 
-- The job identifier is 3000.
Aug 08 17:27:41 ghost-testing systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- An ExecStart= process belonging to unit mysql.service has exited.
-- 
-- The process' exit code is 'exited' and its exit status is 1.
Aug 08 17:27:41 ghost-testing systemd[1]: mysql.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- The unit mysql.service has entered the 'failed' state with result 'exit-code'.
Aug 08 17:27:41 ghost-testing systemd[1]: Failed to start MySQL Community Server.
-- Subject: A start job for unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit mysql.service has finished with a failure.
-- 
-- The job identifier is 3000 and the job result is failed.
Aug 08 17:27:41 ghost-testing systemd[1]: mysql.service: Scheduled restart job, restart counter is at 3.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Automatic restarting of the unit mysql.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Aug 08 17:27:41 ghost-testing systemd[1]: Stopped MySQL Community Server.
-- Subject: A stop job for unit mysql.service has finished
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A stop job for unit mysql.service has finished.
-- 
-- The job identifier is 3051 and the job result is done.
Aug 08 17:27:41 ghost-testing systemd[1]: Starting MySQL Community Server...
-- Subject: A start job for unit mysql.service has begun execution
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit mysql.service has begun execution.
-- 
-- The job identifier is 3051.
Aug 08 17:27:42 ghost-testing systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- An ExecStart= process belonging to unit mysql.service has exited.
-- 
-- The process' exit code is 'exited' and its exit status is 1.
Aug 08 17:27:42 ghost-testing systemd[1]: mysql.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- The unit mysql.service has entered the 'failed' state with result 'exit-code'.
Aug 08 17:27:42 ghost-testing systemd[1]: Failed to start MySQL Community Server.
-- Subject: A start job for unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit mysql.service has finished with a failure.
-- 
-- The job identifier is 3051 and the job result is failed.
Aug 08 17:27:42 ghost-testing systemd[1]: mysql.service: Scheduled restart job, restart counter is at 4.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Automatic restarting of the unit mysql.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Aug 08 17:27:42 ghost-testing systemd[1]: Stopped MySQL Community Server.
-- Subject: A stop job for unit mysql.service has finished
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A stop job for unit mysql.service has finished.
-- 
-- The job identifier is 3102 and the job result is done.
Aug 08 17:27:42 ghost-testing systemd[1]: Starting MySQL Community Server...
-- Subject: A start job for unit mysql.service has begun execution
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit mysql.service has begun execution.
-- 
-- The job identifier is 3102.
Aug 08 17:27:43 ghost-testing systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- An ExecStart= process belonging to unit mysql.service has exited.
-- 
-- The process' exit code is 'exited' and its exit status is 1.
Aug 08 17:27:43 ghost-testing systemd[1]: mysql.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- The unit mysql.service has entered the 'failed' state with result 'exit-code'.
Aug 08 17:27:43 ghost-testing systemd[1]: Failed to start MySQL Community Server.
-- Subject: A start job for unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit mysql.service has finished with a failure.
-- 
-- The job identifier is 3102 and the job result is failed.
Aug 08 17:27:44 ghost-testing systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Automatic restarting of the unit mysql.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Aug 08 17:27:44 ghost-testing systemd[1]: Stopped MySQL Community Server.
-- Subject: A stop job for unit mysql.service has finished
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A stop job for unit mysql.service has finished.
-- 
-- The job identifier is 3153 and the job result is done.
Aug 08 17:27:44 ghost-testing systemd[1]: Starting MySQL Community Server...
-- Subject: A start job for unit mysql.service has begun execution
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit mysql.service has begun execution.
-- 
-- The job identifier is 3153.
Aug 08 17:27:45 ghost-testing systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- An ExecStart= process belonging to unit mysql.service has exited.
-- 
-- The process' exit code is 'exited' and its exit status is 1.
Aug 08 17:27:45 ghost-testing systemd[1]: mysql.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- The unit mysql.service has entered the 'failed' state with result 'exit-code'.
Aug 08 17:27:45 ghost-testing systemd[1]: Failed to start MySQL Community Server.
-- Subject: A start job for unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit mysql.service has finished with a failure.
-- 
-- The job identifier is 3153 and the job result is failed.
Aug 08 17:27:45 ghost-testing systemd[1]: mysql.service: Scheduled restart job, restart counter is at 6.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Automatic restarting of the unit mysql.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Aug 08 17:27:45 ghost-testing systemd[1]: Stopped MySQL Community Server.
-- Subject: A stop job for unit mysql.service has finished
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A stop job for unit mysql.service has finished.
-- 
-- The job identifier is 3204 and the job result is done.
Aug 08 17:27:45 ghost-testing systemd[1]: mysql.service: Start request repeated too quickly.
Aug 08 17:27:45 ghost-testing systemd[1]: mysql.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- The unit mysql.service has entered the 'failed' state with result 'exit-code'.
Aug 08 17:27:45 ghost-testing systemd[1]: Failed to start MySQL Community Server.
-- Subject: A start job for unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit mysql.service has finished with a failure.

mysql error log snippet:

2022-08-08T17:40:00.462991Z 1 [ERROR] [MY-012962] [InnoDB] The redo log file ./#innodb_redo/#ib_redo5 size 2531328 is not a multiple of innodb_page_size
2022-08-08T17:40:00.463060Z 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Generic error.
2022-08-08T17:40:00.843667Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2022-08-08T17:40:00.843922Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-08-08T17:40:00.843960Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-08-08T17:40:00.844806Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30-0ubuntu0.20.04.2)  (Ubuntu).
2022-08-08T17:40:01.561721Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30-0ubuntu0.20.04.2) starting as process 5043
2022-08-08T17:40:01.572518Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-08-08T17:40:01.740440Z 1 [ERROR] [MY-012962] [InnoDB] The redo log file ./#innodb_redo/#ib_redo5 size 2531328 is not a multiple of innodb_page_size
2022-08-08T17:40:01.740508Z 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Generic error.
2022-08-08T17:40:02.118387Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2022-08-08T17:40:02.118717Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-08-08T17:40:02.118754Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-08-08T17:40:02.119396Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30-0ubuntu0.20.04.2)  (Ubuntu).

I am pretty sure this is the fix. I haven’t gotten it to work yet but the error is similar to what I’m seeing in mysql error.log

It looks like yo have some MySQL5 installed. Therefore, I suggest you completely remove MySQL and start over.

Remove any mysql…

sudo apt purge mysql-*
sudo cp -R /var/lib/automysqlbackup/ ~
sudo dpkg -l | grep mysql
 [An empty response if uninstalled]

Tidy up…

sudo apt autoremove
sudo apt autoclean

Install MySQL8…

sudo apt update
sudo apt install mysql-server
sudo systemctl start mysql.service
sudo mysql_secure_installation
1 Like

I’m fairly confident my issue was related to the link I posted. I’m just going to mark that as solution and move on.

Thank you for your patience and help!

Did you get that solution working? If not, then marking it that way is misleading.

1 Like

sudo apt purge mariadb-server

sudo apt autoremove --purge

Try these

Same error installing mysql-server on Ubuntu22, the solution was:

sudo apt-get clean
sudo apt-get purge ‘mysql*’
sudo apt-get update
sudo apt-get install -f
sudo apt-get install mysql-server-8.0
sudo apt-get dist-upgrade
sudo apt-get install mysql-server

From How to solve dependency problem on installing mysql to ubuntu? - Unix & Linux Stack Exchange

That guide was for Ubuntu 20.04 not 22.04.

This is all you need to do.

sudo apt update && sudo apt upgrade --yes
sudo apt install mysql-server --yes
sudo systemctl start mysql.service
sudo mysql

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '<password>';
QUIT;

sudo mysql_secure_installation