Question
Cant connect to MySQL with localhost
Hi, I’m new to Digital Ocean,
recently set up a droplet from scratch following tutorials and encountered an error when connecting to a database, so I tried a droplet using one click app, selecting MySQL on 18.04. Im encountering exactly the same problem. I’ve tried numerous solutions after searching google and this community for the past few hours but nothing has fixed it.
Running a connection test returns the error ‘Can’t connect to local MySQL server through socket ’/var/run/mysqld/mysqld.sock’ (2)’, I’ve checked socket location and port is correct in /etc/mysql/mysql.conf.d/mysqld.cnf which it is. Further scripts keep returning 'can’t connect to localhost’, all database info is correct and connection works in terminal. I’ve started, restarted, re-installed mysql driver, now its driving me crazy!
Can anyone advise?
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.
×
It’s most likely these scripts you are running.
Edit: might be a low'memory issue too.