Are you facing 'ERROR: PleskDBException: Unable to connect to database'?
This guide will help you.
This Plesk 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 Ibmi Media, as part of our Server Management Services, we regularly help our Customers to resolve Plesk database related issues.
In this context, we shall look into how to fix this Plesk error.
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 Experts 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: 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: #007/usr/bin/mysqladmin: connect to server at ‘localhost’ failed
Mar 21 00:16:58 h2600744 /etc/init.d/mysql: 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: Check that mysqld is running and that the socket: ‘/var/run/mysqld/mysqld.sock’ exists!
1. 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
2. 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".
i. 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.
ii. 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.
This article covers methods to resolve error: pleskdbexception: unable to connect to database which triggers as a result of various reasons that include InnoDB engine corruption, disk space full, data directory not completely restored or recovered, and so on.
The reason of this error is due to disk full and you need to delete extra file from my linux Server.
fslint is a Linux utility to remove unwanted and problematic cruft in files and file names and thus keeps the computer clean. A large volume of unnecessary and unwanted files are called lint. fslint remove such unwanted lint from files and file names.
To Clear RAM Memory Cache, Buffer and Swap Space on Linux:
1. Clear PageCache only. # sync; echo 1 > /proc/sys/vm/drop_caches.
2. Clear dentries and inodes. # sync; echo 2 > /proc/sys/vm/drop_caches.
3. Clear PageCache, dentries and inodes. # sync; echo 3 > /proc/sys/vm/drop_caches.
4. Sync will flush the file system buffer. Command Separated by “;” run sequentially.
To find largest files including directories in Linux is as follows:
1. Open the terminal application.
2. Login as root user using the sudo -i command.
3. Type du -a /dir/ | sort -n -r | head -n 20.
4. du will estimate file space usage.
5. sort will sort out the output of du command.
To uninstall an RPM package:
1. Execute the following command to discover the name of the installed package: rpm -qa | grep Micro_Focus. This returns PackageName , the RPM name of your Micro Focus product which is used to identify the install package.
2. Execute the following command to uninstall the product: rpm -e [ PackageName ]