Is it possible to copy a local MySQL database to a remote MySQL database?

Situation: I have 2 servers, one of them currently hosting a live WordPress site, and I want to be able to transfer the site to the other server in case the first server goes down. Transferring the source files is easy; transferring the database is what I need to figure out how to do. Both of the servers are Windows Server 2008.
Is there any easy to do this?

Related posts

2 comments

  1. Simplest way would be to mysqldump the database, transfer it using the same mechanism you have for your source files, then import it into mysql.

    Dump the primary database…

    mysqldump -u user -p database > c:somedirbackup.sql
    

    …transfer the sql file…

    Import on the failover…

    mysql -u user -p database < c:somedirbackup.sql
    

    Both export and import can easily be scripted in batch files.

  2. The easiest way that I know is using the plugin “Duplicator“. I used it several times with Apache servers, but as is commented here, seems that three years ago it was running ok with Windows 2008 IIS 7, so I figure now it would be better.

    Duplicator generates two packages: one with fields (where you can exclude uploads if needed) and the other with the database. Once you have the two packages, you need to upload into your new server and install the package. Of course you need the new database credentials. The plugin ask you in the las step for the new url base to make the adequate substitutions in all the database.

Comments are closed.