Articles in this section

Plesk is not accessible due to stuck mysqld/mariadbd process: "Connection refused" or "No such file or directory"

Plesk for Linux kb: technical

Symptoms

  • Plesk interface is not accessible with this message in a web browser:

    PLESK_INFO: Plesk\Exception\Database: DB query failed: SQLSTATE[HY000] [2002] Connection refused


    PLESK_INFO: DB query failed: SQLSTATE[HY000] [2002] No such file or directory

  • MySQL/MariaDB service status reports this error:

    # service mysql status
    ...
    Active: deactivating (stop-sigterm) (Result: exit-code) since Thu 2024-06-20 06:01:50 EEST; 36min ago
    ...
    mariadbd[561691]: [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
    mariadbd[561691]: [Note] InnoDB: Check that you do not already have another mariadbd process using the same InnoDB data or log files.


    # systemctl status mariadb.service
    ● mariadb.service - MariaDB 10.3 database server
    Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
    Active: failed (Result: exit-code)
    .....
    plesk.example.com systemd[1]: mariadb.service: Found left-over process 3037766 (mysqld) in control group while starting unit. Ignoring.
    plesk.example.com systemd[1]: This usually indicates unclean termination of a previous run, or service implementation deficiencies.
    plesk.example.com systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
    plesk.example.com systemd[1]: mariadb.service: Failed with result 'exit-code'.
    plesk.example.com systemd[1]: Failed to start MariaDB 10.3 database server.

Cause

Stuck mysqld process:

# ps auxfffwww | grep mysql
mysql 2222309 20.6 9.3 17574576 6182096 ? Sl Apr25 12999:45 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

or mariadbd process:

# ps aux | grep mariadb
mysql 456786 86.6 3.9 9417400 2557260 ? Ssl Jun19 826:49 /usr/sbin/mariadbd

Resolution

  1. Connect to the Plesk server via SSH.

  2. Find the PID of the stuck MySQL/MariaDB service:

    # ps aux | grep -E 'mysql|mariadb' | grep -v 'grep'
    mysql 456786 86.6 3.9 9417400 2557260 ? Ssl Jun19 826:49 /usr/sbin/mariadbd

  3. Using the process PID, kill the stuck process:

    # kill -9 456786

  4. Start the MySQL/MariaDB service:

    # service mysql start

    OR

    # service mariadb start

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.