By jgojariya
Error establishing a database connection wordpress. Is there any proper solution? I have tried many things but after 2 to 4 days same error occurs.
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!
Thank you. I have already 1gb/30gb server. This error never occurs in shared hosting.
You can use this script to restart your server whenever there is database connection error. https://github.com/Gurnoor30196/Launch-Mysql
Hello, @avdi
Have you checked the MySQL error_log in order to see if the server is running out of memory or if the issue is with to many MySQL connections? As per the tutorial you can run this command in order to check if the server have recently run out of memory:
zgrep -a "allocate memory" /var/log/mysql/error.log*
zgrep will search through log files, including older log files that have been archived as compressed .tar.gz files. We’re searching for lines that contain allocate memory, in any error.log* file in the /var/log/mysql/ directory.
You can always login and check the MySQL error_log when the issue occurs using tail to either check the last 100 entries in the log or monitor the log in real time:
tail -n 100 /var/log/mysql/error.log
and monitor it in real time:
tail -f /var/log/mysql/error.log
Hope that this helps! Regards, Alex
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.