Unable to connect to database: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: No such file or directory

Created:

2016-11-16 12:44:46 UTC

Modified:

2017-04-24 12:13:01 UTC

0

Was this article helpful?


Have more questions?

Submit a request

Unable to connect to database: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: No such file or directory

Applicable to:

  • Plesk for Linux

Symptoms

Plesk panel shows the following error on the login screen:

ERROR: PleskFatalException
Unable to connect to database: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: No such file or directory

0: common_func.php3:153
psaerror(string 'Unable to connect to database: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: No such file or directory')
1: auth.php3:112:

and the "mysqld" script is missed from the "/etc/init.d" directory.

Cause

The MySQL packages are absent.

Resolution

NOTE: kindly create backup of all databases before applying the solution:

#mysqldump -uadmin -p`cat /etc/psa/.psa.shadow` -A > all-databases.sql
  1. Remove all MySQL packages:
    # rpm -e --nodeps mysql-5.0.95-5.el5_9 mysqlclient15-5.0.91-1.el5.1 mysql-connector-odbc-3.51.26r1127-2.el5 mysql-5.0.95-5.el5_9 mysql-server-5.0.95-5.el5_9 --justdb

Actual versions may differ, you may find them by running

# rpm -qa | grep mysql

2.Remove InnoDB log files:

    # rm /var/lib/mysql/ib_logfile0
# rm /var/lib/mysql/ib_logfile1

3.Re-install MySQL packages anew:

# yum install mysqlclient15 mysql-server mysql-connector-odbc mysql-libs mysql

4.Start the service (this initializes the InnoDB engine and recreated the data inside '/var/lib/mysql'):

# /etc/init.d/mysqld start

All databases should be keep untouched. If it is not, perform usual restoration process from the daily backups ( /var/lib/psa/dumps/ )

Have more questions? Submit a request
Please sign in to leave a comment.