I dont know what to do. I can see my website www.willtek.com.mx and my Bases de datos MySQL® is ok. What do I have to do to fix this.
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!
Hi @etikparati,
When you get Error Establishing Database connection, there are two things that could actually cause it, well more than 2 but if your MySQL is on a local environment then are 2.
MySQL Service
It’s possible your MySQL service to have gone down/be killed by your server due to RAM being insufficient but I’m going ahead of myself.
To check if your MySQL service is down, ssh to your droplet
ssh root@YourDropletIp
Once you are in, type in one of the following 3 (If any of them fail, try with the next one)
service mysql status
service mysqld status
service mariadb status
There are 3 different commands as there is no way for me which exactly you have installed on your droplet. Anyway, if any of them display the service is not running, just type in
service mysql restart
Please note, you’ll need to use the exact service.
Now your MySQL should be working as well as your website. You’ll need to troubleshoot why your service was down though.
Wrong Configuration
It’s possible your website to be experiencing issues if something in the configuration file has changed. If you have made any changes, I’ll recommend reverting them back.
Another solution would be to check the configuration file of your website and replace the database information with the one you have so it’s up to date and correct.
Remote MySQL
If your MySQL service is on a remote server, It’s possible your connection was blocked by the server.
You can allow connections from an IP on port 3306 by doing so
iptables -A INPUT -p tcp -s 0/0 --sport 1024:65535 -d XXX.XXX.XXX.XXX --dport 3306 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p tcp -s XXX.XXX.XXX.XXX --sport 3306 -d 0/0 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT
You’ll need to replace XXX.XXX.XXX.XXX with your actual IP address.
If this doesn’t help, the First two reasons I mentioned can be applied even if your MySQL droplet is a remote one.
Regards, KDSys
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.