Symptoms:
When accessing PHPMyAdmin from the WHM interface, you are presented with the following error:
mysqli_connect(): (HY000/2002): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)Undefined index: auth_type
Description:
This usually indicates that the permissions on the socket file at /var/lib/mysql/mysql.sock are incorrect and as a result PHPMyAdmin is not able to connect to MySQL using that socket file.
Resolution:
You can check the permission on the file with the following command:
stat /var/lib/mysql/mysql.sock
File: ‘/var/lib/mysql/mysql.sock’
Size: 0 Blocks: 0 IO Block: 4096 socket
Device: fd01h/64769d Inode: 10340663 Links: 1
Access: (0777/srwxrwxrwx) Uid: ( 27/ mysql) Gid: ( 27/ mysql)
Context: system_u:object_r:mysqld_var_run_t:s0
Access: 2021-03-09 09:01:56.665395103 -0600
Modify: 2021-03-09 09:01:25.272075359 -0600
Change: 2021-03-09 09:01:25.272075359 -0600
Birth: -
Here you can see the correct permission set for the file. If the permissions of the file itself are correct then you might need to check the permissions on all the directories in the file's path. That can be done with this:
namei -mo /var/lib/mysql/mysql.sock
f: /var/lib/mysql/mysql.sock
dr-xr-xr-x root root /
drwxr-xr-x root root var
drwxr-xr-x root root lib
drwxr-x--x mysql mysql mysql
srwxrwxrwx mysql mysql mysql.sock
Again here you will see the correct permission set for each directory in the file's path.
Incorrect file or directory permissions can be fixed using the chmod command as described in the article below.
How do I change permissions on a file or folder?
Comments
0 comments
Article is closed for comments.