Here are the following commands I have done.
$ sudo service mysql start
mysql start/running
$ mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
$ aptitude search mysql |grep ^i
i libapache2-mod-auth-mysql - Module Apache 2 pour l'authentification vi
i libdbd-mysql-perl - Perl5 database interface to the MySQL data
i libmysqlclient16 - MySQL database client library
i mysql-client-5.1 - MySQL database client binaries
i mysql-client-core-5.1 - MySQL database core client binaries
i mysql-common - MySQL database common files, e.g. /etc/mys
i mysql-server-5.1 - MySQL database server binaries and system
i mysql-server-core-5.1 - MySQL database server binaries
i php5-mysql - MySQL module for php5
Best Answer
Before reinstalling check /var/log/mysql for logs files which may contain clues as to why mysql is not working. If there are no logs log to file might not be enabled in your configuration: Configure Mysql Error Log
To reinstall any package check installed version with
then for version 5.7 use
If this doesn't allow you to reconfigure the package you can use