I have an error: conecting data base.
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.
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.
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
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.
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.
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.