Koozali.org: home of the SME Server

[SOLVED] Manually moving wordpress to new server

[SOLVED] Manually moving wordpress to new server
« on: November 11, 2016, 09:36:55 PM »
Hi All

First up I'm not an experienced Linux user, I can follow step by step instructions and muddle my way through simple stuff. My first foray into understanding MySQL was last night

I have rebuilt a server that had some issues and manually moved over all users and data (I didn't want to use the affa method to fully restore a SME server as there were some errors I didn't want migrated in the /home/e-smith/...) This is all up and running smoothly for the past week.

The last step is moving our small office intranet. I thought this would be as easy as setting up the correct database and user and copying over the intranet/html directory. alas no I have learned through google that the contents of the site are stored in the MySQL database on the old server.

I have googled how to move this there seems to be two methods, one to create a dump and copy this across and then import it.

mysqldump -u root -p --opt [database name] > [database name].sql

scp [database name].sql [username]@[servername]:path/to/database/

mysql -u root -p newdatabase < /path/to/newdatabase.sql

In the example above what would "path/to/database" be? is it /var/lib/"database"

And another says simply copy /var/lib/"database" to the new server then create a database on the new server of the correct name (wordpress in my case) and add the users.

I really don't want to muck this up as the new server is error free and I don't want to do anything stupid. Can anyone give me some guidance on this as the best (correct) method I just don't know enough at present about MySQL to be confident enough to hit enter. Both servers are running and on the same internal network so I have been using rsync to move everything across rather than scp.

Some help would be appreciated

Cheers
Allan

 
« Last Edit: November 13, 2016, 12:14:22 AM by Allan Pritchard »

Offline brianr

  • *
  • 988
  • +2/-0
Re: Manually moving wordpress to new server
« Reply #1 on: November 12, 2016, 08:34:27 AM »
The best way I know to copy WordPress sites is to use one of the Wordpress backup and restore plugins. I use Updraft.  You can then backup the old system (Dropbox? - that is what I use), then restore it on the new system (with an initial WP + Updraft installed).  The plugin takes care of all the details. The free Updraft will cope with moving the backup to a new server where the URL etc of the site is not changing (which I guess ius what you are doing), you'll need the paid for version if you want to change its URL.
« Last Edit: November 12, 2016, 08:36:21 AM by brianr »
Brian j Read
(retired, for a second time, still got 2 installations though)
The instrument I am playing is my favourite Melodeon.
.........

Re: Manually moving wordpress to new server
« Reply #2 on: November 12, 2016, 11:21:49 PM »
Thanks brianr

Unfortunatly I have not had any success. I brought up the old server and set it back as the main server with the original IP Address. Checked the intranet was working (previously it was trying to find pages on the original IP address which is now the main server). Installed updraft and backed up the site.

Swapped everything back so the the new server has the correct IP and the old server a different one. Installed the latest version of wordpress and followed the install wordpress as a multisite from the howto's and installed updraft plugin. Then copied the backup from oldserver to the newserver leaving it in the original location.

Updraft wouldn't recognize the backup existed so I created a new backup which would just be the default WP Site. I then replaced those files with the backup I want it to use but kept the file names. Updraft found the back up and restored everything (all of the uploads and themes were present when I checked in their directories) but there were no pages nor did the uploads appear in the media library. So whatever has happened it hasn't copied the database over.

I'll keep persisting and maybe try another backup plugin.

Cheers
Allan

Re: Manually moving wordpress to new server
« Reply #3 on: November 13, 2016, 12:13:59 AM »
Hi

Using the plugin Backup Guard I have managed to migrate the intranet across with all users and pages intact.

Thanks Brianr for pointing me in the right direction. I couldn't get updraft to work but Backup-guard worked perfectly and allowed me to copy the 300m backup between the servers and then do a restore on the new server.

Cheers
Allan

Offline brianr

  • *
  • 988
  • +2/-0
Re: Manually moving wordpress to new server
« Reply #4 on: November 13, 2016, 01:00:53 PM »
Hi

Using the plugin Backup Guard I have managed to migrate the intranet across with all users and pages intact.

Thanks Brianr for pointing me in the right direction. I couldn't get updraft to work but Backup-guard worked perfectly and allowed me to copy the 300m backup between the servers and then do a restore on the new server.

Cheers
Allan

You are very welcome.  :-)
Brian j Read
(retired, for a second time, still got 2 installations though)
The instrument I am playing is my favourite Melodeon.
.........

Offline janet

  • ****
  • 4,812
  • +0/-0
Re: [SOLVED] Manually moving wordpress to new server
« Reply #5 on: November 14, 2016, 12:06:46 AM »
There are a lot of tips in this article re selective backup & restore using tar & ssh
https://wiki.contribs.org/Backup_server_config

Also various tips in the mysql article for dumping & transferring databases
https://wiki.contribs.org/SME_Server:Documentation:FAQ:Section06
« Last Edit: November 14, 2016, 12:08:32 AM by janet »
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Re: [SOLVED] Manually moving wordpress to new server
« Reply #6 on: November 14, 2016, 12:51:54 AM »
Thanks Janet

The reason we created a completely new server was someone accidentally did a chown -R staff:staff / *.* which destroyed the permissions on the sever. We got most of it back working by resetting permissions but there were a lot of permissions in log files and strange things happening with qmail and spam assassin. We decided to abandon that server and just transfer user home directories and ibay data to a new server.

Under the MySQL article I couldn't find how to transfer a database or anything about dumping, just creating one and adding users, optimization etc. I think I'll build a new test server so I can play around and learn a bit about MySQL in a safe environment :)

Cheers
Allan