Mysql restart after server reboot is giving an error when using systemd

After a reboot mysql doesnt start.
Looking at the errorlogs I see " --initialize specified but the data directory has files in it. Aborting."
which obviously means that it is trying to start with --initialize after a reboot.
I asked our sysadmin to run “systemctl unset-environment MYSQLD_OPTS” just in case something strange happened (this is after an os upgrade).
It is still giving me the same error.
What else should I look at?
Starting up the service manually like sudo service mysql start doesnt give any errors.

It sounds like mysql is starting on boot, but, as you discovered it’s trying to initialize. Can you confirm the OS and MySQL version please?

OS is oracle linux 8 and mysql version is 8.0.21-12 Percona Server

Do you have the mysql data dir mounted from NFS or other sharing service? If so, it may be that the mount is not mounted when the system boots and thus it fails, but when you do it manually, it has mounted and it’s fine.

Yes it is nfs.
Let me check with the sysadmin.
What do you suggest when using NFS to avoid the issue of it not mounting before the service starts?

Your sysadmin can modify the unit file for mysql to have it depend on nfs mounts. That way nfs will mount before mysql starts.