Are you getting this error on your WordPress website?
“error establishing database connection”
Create a file mysql.sh with this code :
#!/bin/bash UP=$(/etc/init.d/mysql status | grep running | grep -v not | wc -l); if [ "$UP" -ne 1 ]; then echo "MySQL is down."; service mysql start else echo "All is well."; fi
$ chmod +x mysql.sh $ crontab -e
One file will open after running the above command. Now, you just add the below line at the end of the file and after that save it.
*/5 * * * * /<path>/mysql.sh
If you are getting this error :
then you have to convert the file with dos to unix converter. I have used one online: http://newline.nadav.org/
Useful links :