Applicable to:
- Plesk for Linux
Symptoms
- Unable to log in to Plesk, the following error appears:
CONFIG_TEXT: ERROR: PleskDBException: Unable to connect to database: mysql_connect(): Permission denied /var/lib/mysql/mysql.sock (Error code: 2002).
CONFIG_TEXT: ERROR: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2002] Permission denied' in /usr/local/psa/admin/externals/Zend/Db/Adapter/Pdo/Abstract.php
-
Unable to start
mariadb
service with the following error:CONFIG_TEXT: systemd[1]: Starting MariaDB database server...
mariadb-prepare-db-dir[4030]: chmod: changing permissions of Б─≤/var/lib/mysqlБ─≥: Operation not permitted
mariadb-prepare-db-dir[4030]: Initializing MySQL database
mariadb-prepare-db-dir[4030]: chown: changing ownership of Б─≤/var/lib/mysqlБ─≥: Operation not permitted
mariadb-prepare-db-dir[4030]: Cannot change ownership of the database directories to the 'mysql'
mariadb-prepare-db-dir[4030]: user. Check that you have the necessary permissions and try again.
mariadb-prepare-db-dir[4030]: Initialization of MySQL database failed. -
Unable to access MySQL/MariaDB database. The following error appears if trying to log in to database using
mysql
utility:CONFIG_TEXT: ERROR 1018 (HY000): Can't read dir of './db-name/' (errno: 13)
-
The permissions of
/var/lib/mysql/
are different from listed below:# ls -ld /var/lib/mysql
drwxr-xr-x 5 mysql mysql 4096 Apr 20 13:05 /var/lib/mysql
Cause
Incorrect permissions for
/var/lib/mysql/
directory and its subdirectories.
Resolution
- Log in to the server via SSH;
Note: if direct SSH access to the server is not possible, contact server administrator for further assistance.
-
Set proper owner to the directory and files:
# chown -R mysql:mysql /var/lib/mysql
# find /var/lib/mysql/* -type d -exec chmod 0700 {} \;
# find /var/lib/mysql/* -type f -exec chmod 0660 {} \;For Debian/Ubuntu
# chmod 700 /var/lib/mysql
For RHEL/CentOS
# chmod 755 /var/lib/mysql
Comments
0 comments
Please sign in to leave a comment.