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?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Click below to sign up and get $100 of credit to try our products over 60 days!