Error messages when installing Percona mysql 8.0

I’m trying to install mysql 8.0 on ubuntu 22.04lts usinf the steps in Use APT repositories - Percona Server for MySQL and I always get those error messages:

2024-02-26T13:01:12.774549Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.35-27) initializing of server in progress as process 18029
2024-02-26T13:01:12.781122Z 0 [ERROR] [MY-010187] [Server] Could not open file ‘/var/log/mysql/error.log’ for error logging: Permission denied
2024-02-26T13:01:12.782967Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
2024-02-26T13:01:12.783468Z 0 [ERROR] [MY-010119] [Server] Aborting
2024-02-26T13:01:12.783835Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.35-27) Percona Server (GPL), Release ‘27’, Revision ‘2f8eeab2’$.
dpkg: error processing package percona-server-server (–configure):
installed percona-server-server package post-installation script subprocess returned error exit status 1
Processing triggers for libc-bin (2.35-0ubuntu3.6) …
Errors were encountered while processing:
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)

I checked the permission on /var/log/mysql and it’s good.

/var/lib/mysql exist and is empty.

Any idea what could be my problem?

This is literally the problem. Does this file exist? If so, just remove it. Make sure the owner of /var/log/mysql is mysql. Do you have apparmor running? Check the OS audit log and see if apparmor is blocking access to this file.

Hi Matthew,

Everything was fine but I learned that the system that was given to me was hardened and that was causing the problem.

I was given a system with no hardening and when everything is installed, they will harden it.

Thanks for the help,