Articles in this section

Unable to log in to Plesk on Debian/Ubuntu-based distributions: mysql_connect(): No such file or directory /var/run/mysqld/mysqld.sock (Error code: 2002)

Plesk for Linux kb: technical ABT: Group A

Applicable to:

  • Plesk for Linux

Symptoms

  • Unable to log in to Plesk with the following error message:

    PLESK_ERROR: ERROR: PleskDBException: Unable to connect to database: mysql_connect(): No such file or directory /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible. (Abstract.php:69)

  • MySQL service is stopped and cannot be started:

    # service mysql start
    [FAIL] Starting MySQL database server: mysqld . . . . . . . . . . . . . . failed!

  • When stopping MySQL, the operation fails with:

    # service mysql stop
    /usr/sbin/mysqld: Error on realpath() on '/var/lib/mysql-files' (Error 2)
    [ERROR] Failed to access directory for --secure-file-priv. Please make sure that directory exists and is accessible by MySQL Server. Supplied value : /var/lib/mysql-files161215 [ERROR] Aborting

Cause

The directory /var/lib/mysql-files is missing. This is a mysql package bug #1637280.

Resolution

  1. Connect to the Plesk server via SSH.

  2. Create the mysql-files directory using these commands:

    # mkdir /var/lib/mysql-files

    # chown -R mysql:mysql /var/lib/mysql-files/

    # chmod 700 /var/lib/mysql-files/

  3. Start MySQL:

    # service mysql start

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.