Before starting the DB Import, I ran the following command and the out was "Tables Dropped"
sudo -u www-data -H wp db clean --yes --path=/var/www/example.com/htdocs
But now, when I am running it again. The following error pops up:
Error: Error establishing a database connection.
this is normal, the database is empty so WP-CLI cannot access it anymore, it can only import a new database
@VirtuBox Thanks for the help master. I figured it out. Actually, there was a file wp-config.php from the old server inside htdocs folder. Maybe that's what was causing the issue. Successfully imported the database.
You may delete/hide my comments to make the thread clutter free 🙂
nsgoyat Don't worry that will probably be useful for someone else.
I didn't specify it, but it's better to migrate with transferring the previous wp-config.php.
marciomarim I have another short guide I use to migrate a server with multiple sites all at once. Should I post it here too?
Has this been posted somewhere?
ZinkDifferent No, I finally had some SSL renew problems on the server I migrated all at once. So maybe it's safer to migrate one by one.
Could you update above guide with a small remark regarding the "Copy files via rsync" command?
My "old server"'s ssh port differs from default ssh port 22. If that is the case for anyone else, please make sure to modify the rysnc command like so:
rsync -avz -e "ssh -p 12345" --progress --ignore-existing .....
slitweb Alternative command with custom ssh port added
An extented version of this guide is now available in the documentation :
Thanks again @marciomarim for writing this guide. Let me know if you would like to have your name set as initial author in our documentation.
Great @VirtuBox but no need for credits!
@marciomarim @VirtuBox, I need some serious help guys. I have migrated a lot of WP sites using the same guide but just tried migrating a Multisite (sub-directories based) to a new domain but I always end up getting "database connection error"
Any way to debug the issue?
Hosted by VirtuBox