Problem with mysql database after migrating my wordpress website

  • I have lamp stack droplet
  • I created 2 wordpress website and they were working fine
  • I installed the wordpress and made a virtual host to another wordpress website , I completed the the wordpress installation and I installed this plugin (All-in-One WP Migration ) to migrate my working wordpress website which is currently hosted on another shared hosting
  • I migrated the website successfully from the shred hosting to my droplet using the wordpress plugin (All-in-One WP Migration )
  • I changed the dns to point to DO servers
  • All websites crashed and I get the “Error establishing a database connection”
  • I tried to access the mysql root using this command : “$ mysql -u root -p” but I got this message : “ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)”
  • I used this guide to install wordpress like I did with the first 2 websites : and I’m pretty sure some steps in this guide is conflicting the migration process and causing the websites crash. Please help me to fix it ?

Update :

  • the other 2 websites back to work
  • the migrated website : I can load the home page only , and I can login to wordpress
  • I can’t install new plugins , and when I tried , everything crash again (including the other 2 websites) !

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.


I just came across this question.

Regarding your MySQL error, I could suggest making sure that MySQL is running with the following command:

  1. sudo systemctl status mysql

If it is not running you can start it with the following command;

  1. sudo systemctl start mysql

Regarding the new plugin issue, usually, this could be due to incorrect permissions. What you could do is make sure that your WordPress files and folders are owned by your Apache user:

chown -R www-data: /var/www/html

Note that if your Apache service is running as another user you would need to change the www-data with your actual user.

Regards, Bobby