Bobcares

WeSupport

Call Us! 1-800-383-5193
Call Us! 1-800-383-5193
Call Us! 1-800-383-5193

Need Help?

Emergency Response Time custom

Our experts have had an average response time of 11.06 minutes in March 2021 to fix urgent issues.

We will keep your servers stable, secure and fast at all times for one fixed price.

ERROR: PleskDBException: Unable to connect to database

by | Mar 25, 2021

Are you trying to find a solution for ‘ERROR: PleskDBException: Unable to connect to database’? We can help you fix it.

This error can occur due to various reasons that include InnoDB engine corruption, disk space full, data directory not completely restored or recovered, and so on.

Here at Bobcares, we often receive requests relating to database issues as part of our Server Management Services for web hosts and online service providers.

Today, let’s see how our Support Engineers fix this Plesk error.

 

How to fix error: pleskdbexception: unable to connect to database

Recently, one of our customers approached us telling us that when he tried to access the Plesk control panel, the following error appears:

“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)”

MySQL works fine and even the web applications are running without any problems.

Now let’s take a look at how our Support Engineers resolve this error.

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

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

As a result, we found the below log entries.

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!

Here are the steps we follow to resolve this error.

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

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

Next, we start the MySQL service. For that, we run the following commands.

# 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 we check if the data directory is completely restored/recovered. If not, we will need to recover it.

* Also, we delete files that are not needed so that we can free up some disk space. We can check the disk space using df and du commands.

# df -h

The du command displays disk usage. Or else, we can run the below command.

# 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.

[Still, not able to fix database problems? – We’d be happy to help you]

 

Conclusion

In short, this error can occur due to various reasons that include InnoDB engine corruption, disk space full, data directory not completely restored or recovered, and so on. Today, we saw how our Support Engineers fix this error.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

GET UP TO 25% OFF

Plesk Support

Spend time on your business, not on your servers.

Managing a server is time consuming. Whether you are an expert or a newbie, that is time you could use to focus on your product or service. Leave your server management & end-user tech support to us, and use that time to focus on the growth and success of your business.

TALK TO USOr click here to learn more.

GET UP TO 25% OFF

Plesk Support

Spend time on your business, not on your servers.

Managing a server is time consuming. Whether you are an expert or a newbie, that is time you could use to focus on your product or service. Leave your server management & end-user tech support to us, and use that time to focus on the growth and success of your business.

TALK TO USOr click here to learn more.

Categories:

Tags:

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF