Link to database cannot be established: SQLSTATE[HY000] [2002] Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (111)
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!
Accepted Answer
@Jabo - Have any changes been made to MySQL? If so, what changes were made? That specific error is a good sign that MySQL has crashed, failed to restart or has been stopped. In the case of the config, changes can cause MySQL to fail to start. Given that MySQL is rapidly developed and changes are always being made, it’s entirely possible that your my.cnf file is attempting to interpret a configuration variable that is no longer used or does not apply to your setup.
If you made changes to my.cnf before shutting MySQL down, and then abruptly restarted it, this too can cause such an error.
Ultimately, you would need to login as root, run top and see if any instances of MySQL are running. If so, kill them off. You can also run ps -ef | grep mysql to see if any MySQL processes pop up to confirm all are killed off.
You should then be able to restart MySQL from the CLI.
This comment has been deleted
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.