You will see sites showing database connection error even when database login details configured are correct.
This happens when mysql data directory “/var/lib/mysql” is not mounted in cagefs.
[email@example.com ~]# grep "/var/lib/mysql" /etc/cagefs/cagefs.mp [firstname.lastname@example.org ~]#
As you can see there is no “/var/lib/mysql” folder entry in the cagefs.mp file
Add the lines “/var/lib/mysql” to “/etc/cagefs/cagefs.mp” and remount the cagefs.
echo "/var/lib/mysql" >> /etc/cagefs/cagefs.mp cagefsctl --remount-all
If you have moved the mysql folder to a different location then also you may see the same problem. In that case add the new folder path to cagefs e.g if you moved it to /home/mysql then add /home/mysql to cagefs.mp file