Join 1M+ other developers and:
- Get help and share knowledge in Q&A
- Subscribe to topics of interest
- Get courses & tools that help you grow as a developer or small business owner
How to fix: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) on Ubuntu - version = 20.04.1 LTS
For past few weeks i have been trying to install apache and mysql on my Ubuntu 20.04.1 LTS (GNU/Linux 5.4.0-54-generic x86_64)(digitalocean).
But i have been facing the same error again and again, no matter what i do this is the error i am facing
"ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)"
i have tried everything every solution but nothing worked.
i have installed mysql and apache in my debian server which is working fine but i don’t know why (here in digitalocean) i am facing this error again and again.
i have followed the digitalocean tutorial twice but whenever i reached at this
"sudo mysql_secure_installation" step i got this error: "Error: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)" i cant pass this step no matter what.
i need help how can i install all services without any issue i have to run a laravel website in this server.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×