Hi I have installed my WordPress in Digital ocean. when I tried to open my website (which is under development) the following error is displayed “Error establishing database connection”. i got my domain name from godaddy. What should i do to resolve this issue…
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 there @chandrandivya90,
It sounds like that your MySQL service might not be up and running. In order to start it you need to first SSH to your Droplet as per the instructions here:
https://docs.digitalocean.com/products/droplets/how-to/connect-with-ssh/
After that try to start the MySQL service:
systemctl start mysql
Let me know how it goes! Regards, Bobby
Hello, @chandrandivya90
First, you can ensure that the MySQL service is up and running:
- sudo systemctl status MySQL
You can double-check the database credentials in the wp-config.php file and make sure that they are added correctly in the file, e.g no blank spaces or typos.
It’s worth attempting to connect to the database from the command line, just to make sure. Copy and paste the details right from the config file into the following command:
- mysqlshow -u database_username -p
You’ll be prompted for a password. Paste it in and press ENTER. If you get an Access denied error, your username or password is incorrect.
You can also double-check the site files/folders permissions and ownerships. to set the correct permissions on the WordPress directories and files:
sudo find /var/www/wordpress/ -type d -exec chmod 750 {} \;
sudo find /var/www/wordpress/ -type f -exec chmod 640 {} \;
Another thing to check is the salt and key values in the wp-config.php file. More information can be found in our tutorial here:
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.
From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.