Tried to install MySQL on Ubuntu, with these 3 commands:

sudo apt update
sudo apt install mysql-server

When running the last command, it asks for the password for the root account. After I enter it, I got the following error:

Securing the MySQL server deployment.

Enter password for user root:
Error: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

I have checked and apparently there is no mysqld.sock file anywhere.

Is there anything else I should run that I haven't yet?

1 Answer 1


I know there are a lot of descriptions about this error on the internet, but there seems to be many causes for that, and all of them seems linked to installation.

In my case, I found out my "sudo" access had some issues. After I've corrected them, I've uninstalled everything and installed again, and everything seems to work fine now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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