Situation description
I have a linux server:
Distributor ID: Debian Description: Debian GNU/Linux 5.0.10 (lenny) Release: 5.0.10 Codename: lenny
Lately, the MySQL server was a litte bit slow when trying to establish a connection to the databases, so I tried to restart the service with
service mysql restart
since then 2 things happened:
- The service stops and refuses to be restarted once again
- It displays an error:
Once I try service mysql (start or restart or even stop)
error:tail: invalid option -- n Try `tail --help' for more information. tail: invalid option -- n Try `tail --help' for more information.
mysql start
gives:ERROR 2002 Can't connect to local Mysql server through socket /var/run/mysqld/mysqld.sock (2)
But this file doesn’t exist in any way in this directory. I though that maybe this file is located somewhere else in my server and the
my.cnf
just contains the wrong path and this is why the call fails. I tried to find the right path for the file:mysqld.sock
and edit the required line inmy.cnf
file, but with find command I figure out there is no such a filemysqld.sock
ormysql.sock
in all the server directories.In a next step I tried to re-install the MySQL server from scratch, what happened is that the old MySQL version and also Apache was successfully removed and the process for the installation was broken and failed to continue.
php -v
shows the next output:PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613/mysql.so' - /usr/lib/php5/20060613/mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613/mysqli.so' - /usr/lib/php5/20060613/mysqli.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613/pdo_mysql.so' - /usr/lib/php5/20060613/pdo_mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP 5.2.6-1+lenny16 with Suhosin-Patch 0.9.6.2 (cli) (built: Feb 3 2012 08:19:55) Copyright (c) 1997-2008 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies with the ionCube PHP Loader v3.1.28, Copyright (c) 2002-2007, by ionCube Ltd.
What I am trying to do now:
I made a backup for my websites located under
/var/www/vhosts
and I want to upgrade the system to Wheezy 7.0 Then to install Apache and MySQL what can I do in such a case, I don’t even know if I still have my databases or they are already lost.What steps are required to fix that?
Have to reconfigure after that the virtual host to enable my websites once again.
I am lost any help?
EDIT:
To install mysql on debian Lenny I tried this:
aptitude -t lenny-backports install mysql-server-5.1 mysql-client-5.1 mysql-common
During the installation it displays that a connecxion test was faild, in the error log file:
mysql: error while loading shared libraries: libreadline.so.6: cannot open shared object file: No such file or directory
Answer
Your server was compromised (as per previous question and also confirmed somehow with the strange behaviour of binaries like tail
or others that were replaced).
So you have to do a clean re-install of everything; no commands can be trusted and they may not work properly as it seems to be happening. You should use a new server and install Linux and the rest of the stack (mysql, php etc) from scratch from repositories, or copy your data and code, wipe your current server and re-install.
Before that you want to try and figure out where the vulnerability was that they exploited so it doesn’t happen again.
Also you want to test first in a server or investigate (ask, seach) if newer (current) versions of the stack (especially PHP) have backwards-incompatibility issues.
Attribution
Source : Link , Question Author : amani , Answer Author : LinuxDevOps