Question

Im installing Wordpress Using EasyEngine, How I backup my database, when My site has been take down by DMCA in Digital Ocean

Posted February 27, 2020 727 views
NginxWordPressBackups

My site got hit by DMCA and badly I didnt know until I see my site was down, Im planing to move my site to another hosting, but how do I backup my wordpress database and download it, wp file already succeed being backup, but I cant dump any database

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.

×
3 answers

Hi @caknoris696,

I’m sorry to hear that, can you confirm exactly what happened, maybe we can remedy the situation somehow?

As for the Database backup, it should be fairly easy. Find your DB credentials which should be located in your website’s wp-config.php.

As soon as you do, executing the following command

mysqldump -u username -p database > databasebackup.sql

As soon as you hit enter, you’ll be asked for the Database’s password.

Regards,
KDSys

Hey @KDSys,

Thats it, I’m already see my wp-config configuration which is:

/** The name of the database for WordPress */
define( 'DB_NAME', 'taruhaneuro2020_com' );

but when im using

mysqldump -u root -p taruhaneuro2020_com > databasebackup.sql

its give me this error

mysqldump: Got error: 1049: Unknown database 'taruhaneuro2020_com' when selecting the database
edited by MattIPv4
  • Hi @caknoris696,

    Are you sude the Database is actually hosted on this Droplet and not somewhere else? What does it state in your wp-config.php file for DB_HOST ?

    Regards,
    KDSys

    • /** MySQL hostname */
      define( 'DB_HOST', 'global-db:3306' );
      
      • It seems like your database is stored somewhere else and not on your current droplet. That’s why when you execute the mysqldump command you get an error - unknown database.

        You’ll need to include the host in your mysqldump command like so

        mysqldump -u username -p database -h host > database.sql
        

        Regards,
        KDSys

        • thx for response, I dont know where is my database host because im just installing wordpress using EasyEngine…

          Im tryin this but result the same error

          mysqldump -u root -p taruhaneuro2020_com -h global-db:3306 > gaspol.sql
          
          mysqldump: Got error: 2005: Unknown MySQL server host 'global-db:3306' (11) when trying to connect
          

Since you’re using EasyEngine (v4.x, I assume) you could just use the wp-cli shell to backup your database.

First bring up the shell:
ee shell SITENAME

(Note, If you don’t recall the SITENAME you used when setting up EE, use this command, ee site list.)

Once you are in the wp-cli shell, you can use wp-cli commands. In your case you’ll need to use, wp db export A-FILE-NAME.sql

Personally, I use something like this, wp db export ../backups/wp-dp-bak-$(date +%Y%m%d-%H.%M.%S).sql

That will place the file into a /backups/ folder (which you’ll need to first create whilst in the shell (use mkdir ../backups). And it will name the file with a date-time stamp.

This provides a very easy way to do the backup you want to do.

Note: If you create a backups folder, don’t do this until you are in the ee shell. Otherwise it will likely be owned by root, and the shell won’t have permission to access it.

Submit an Answer