Question
When accessing PHPMyAdmin through the WHM, you are presented with the following:
mysqli_connect(): (HY000/2002): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)
Answer
This usually happens due to the permissions of the mysql.sock file being incorrectly set. Use stat to verify the file permission are 0777. Once these are modified to the proper permissions, you will be able to access the interface as expected.
# stat /var/lib/mysql/mysql.sock
File: ‘/var/lib/mysql/mysql.sock’
Size: 0 Blocks: 0 IO Block: 4096 socket
Device: fd03h/64771d Inode: 3279066 Links: 1
Access: (0777/srwxrwxrwx) Uid: ( 995/ mysql) Gid: ( 991/ mysql)
Access: 2021-03-03 05:35:13.155000000 +0530
Modify: 2021-03-03 00:11:30.135000000 +0530
Change: 2021-03-03 05:35:10.845000000 +0530
Birth: -
If you are unsure how to change this file permission, please review How do I change permissions on a file or folder?