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
Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
I have two droplets, one with a database and one with a website.
I have installed LAMP in both of them (except for the droplet that contains the website which does not have MySQL installed).
I tested the droplets with a simple index page which makes a simple connection to the database and brings text from it to be printed in the body and YES IT DOES WORK, so this confirms me that MySQL server is up and running.
However, when I upload a bigger website I get an error message that says:
Can’t connect to local MySQL server through socket ’/var/run/mysqld/mysqld.sock’ (2)
(Note that this bigger website works perfectly in localhost, running XAMPP)
First tip given was to change the droplet containing the database to one with more capacity, and I did that, however the problem persists.
Then I was told to change the bind address to 0.0.0.0 in “/etc/mysql/my.cnf"… I also did this and still nothing…
Thank’s in advanced
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.×