BLACK FRIDAY SALE IS LIVE !!!!!

Need Assistance?

In only two hours, with an average response time of 15 minutes, our expert will have your problem sorted out.

Server Trouble?

For a single, all-inclusive fee, we guarantee the continuous reliability, safety, and blazing speed of your servers.

‘PleskDBException: Unable to connect to database Error’

The error is caused by the various reason that includes disk space full, InnoDB engine corruption, and data directory not completely restored.

Our technical team support will fix the Plesk error under our Plesk server management services plan. You can also take assistance from our technical team support 24/7 for fixing the error or any sort of installation and migration. 

How to fix error

This was one of the client reports that tell us that he tries to access the Plesk control panel and the following error appears on the screen.

“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 the database server is started and accessible. (Abstract.php:69)”

Whereas MySQL is working well and even the web application has worked well without any sort of issues.

Resolve this error.

We went through the MySQL logs by running the below command.

grep mysql /var/log/syslog | tail -50

The following are the result.

Mar 21 00:16:58 h2600744 /etc/init.d/mysql[29323]: 0 processes alive and ‘/usr/bin/mysqladmin –defaults-file=/etc/mysql/debian.cnf ping’ resulted in Mar 21 00:16:58 h2600744 /etc/init.d/mysql[29323]: #007/usr/bin/mysqladmin: connect to server at ‘localhost’ failed

Mar 21 00:16:58 h2600744 /etc/init.d/mysql[29323]: error: ‘Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)’ Aug 12 00:16:58 h2600744 /etc/init.d/mysql[29323]: Check that mysqld is running and that the socket: ‘/var/run/mysqld/mysqld.sock’ exists!

Follow the few steps to resolve this error

First, we rename the file /etc/init/mysql.conf to /etc/init/mysql.conf.off. For that, you need to run the below command.

# mv /etc/init/mysql.conf /etc/init/mysql.conf.off

Later, run the command to restart the MySQL service.

# sudo service mysql stop
# sudo service mysql start​

Also, we can also perform “plesk repair db -v”.

The socket will not exist if mysqld refuses to start. So you need to check whether the data directory is restored properly. If not, you need to recover it.

You need to delete the non-essential file, in order to gain some disk space by using the df and du commands.

# df -h

The du command displays disk usage. 

# du -h

Moreover, we can add the skip-grant-tables option into /etc/mysql/my.cnf after that we should be able to start the database server.

Conclusion

In brief, the error is caused by the various reason that includes disk space full, InnoDB engine corruption, data directory not completely restored. Follow the steps to fix the problem, if you still face the issue you take our technical team support to fix this error.

Liked!! Share the post.

Get Support right now!

Start server management with our 24x7 monitoring and active support team

Can't get what you are looking for?

Available 24x7 for emergency support.