Linux newb, so please be gentle.

Tried to start mysql using

mysql -u root -p

and I got the following error:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

Online solutions suggested that I should reinstall mysql, so that's what I did, except now I'm getting the following error:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies.
 mysql-server : Depends: mysql-community-server (= 5.6.23-1ubuntu14.10) but it is not going to be installed

Had no luck so far. Apologises if the question is stupid. I've already tried everything suggested in here as well as many other places but to no avail.


List of installed packages:

akonadi-backend-mysql               deinstall
libmysqlcppconn7                deinstall
mysql-apt-config                install
mysql-server-5.5                deinstall
mysql-workbench                 deinstall

No error log, I think it got deleted when I attempted to do a deep complete removal.

  • You may get a better response from serverfault?
    – Ash
    Mar 17, 2015 at 21:56
  • To help further please upload the MySQL error log if it exists (/var/lib/mysql/HOSTNAME.err) and also the list of installed packages, (dpkg --get-selections|grep -i mysql)
    – Trent Lloyd
    Mar 18, 2015 at 0:30
  • Original post updated. Thanks for looking into this, it's driving me insane.
    – Robert C
    Mar 18, 2015 at 8:39

2 Answers 2


Try to remove mysql-apt-config (which is in development and might not be resolving the dependencies correctly) and to reinstall mysql-server from the official repositories:

sudo apt-get purge mysql-apt-config && sudo apt-get install mysql-server
sudo apt-get purge mysql-apt-config && sudo apt-get install mysql-server

Now remove packages that were automatically installed to satisfy dependencies for some package and that are no more needed.

sudo apt-get autoremove -y

Now reinstall MySQL

Install Mysql 5.7

Install Mysql

sudo apt-get update
sudo apt-get install mysql-server=5.7.22-0ubuntu0.16.04.1

Check is Mysql process running

sudo service mysql status

Setup enable remote access (Use Vim, nano, the text editor you prefer...)

sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
Edit conf
bind-address            = --> bind-address            =
Add permission to user

How to create a user and grant permissions

Grant also for root

grant all privileges on *.* to root@'%' identified by <PASSWORD>;
flush privileges;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.