• Support
  • Trouble with WordOps site migration

I'm trying to migrate my site between servers using the following guide:

https://docs.wordops.net/guides/wordpress-migration/

I was able to follow all the steps, but visiting the new site at the end shows a database access error

Connection error. Visit the admin area for more details or open the config.php file and check the database information. Message: Access denied for user 'oldDBusername'@'localhost'.

There has been a critical error on this website.

Learn more about troubleshooting WordPress.

In this case, oldDBusername is from the imported database (and can be found on the old wp-config.php).
Perhaps this is an issue between MariaDB / MySQL / WP-Cli compatibility in the guide?

Here are my steps and some troubleshooting:

I ran into an issue at the following step:

sudo -u www-data -H wp db clean --yes --path=/var/www/mydomain.tld/htdocs
rm -rf /var/www/mydomain.tld/htdocs/*

I get the following error:

Error: Failed to get current SQL modes. Reason: /usr/bin/env: 'mysql': No such file or directory

It appears it may be an issue with a recent WordOps update as someone posted about the issue as well here:

https://community.wordops.net/d/2054-wp-cli-command-error-reason-usrbinenv-mysql-no-such-file-or-directory

After creating the suggested symlinks, I was able to proceed with the migration guide step

mysql: Deprecated program name. It will be removed in a future release, use '/usr/bin/mariadb' instead
Success: Tables dropped.

I was also able to import the database dump as the penultimate step of the guide

cd /var/www/mydomain.tld/htdocs
wp db import mydomain_com_erFwge-2024-10-11-0eg34.sql --allow-root
rm mydomain_com_erFwge-2024-10-11-0eg34.sql

Output:

mysql: Deprecated program name. It will be removed in a future release, use '/usr/bin/mariadb' instead
Success: Imported from 'mydomain_com_erFwge-2024-10-11-0eg34.sql'.

When I look through MariaDB / MySQL database and users on the new server, I only see the database and user detailed in the current (freshly created) wp-config file and nothing from the imported dump.

Sadly, I'm at a loss and don't know how to resolve this. Any pointers?

In this case, oldDBusername is from the imported database (and can be found on the old wp-config.php).

Did you copy over the old wp-config.php..? (The guide does say "Do not copy the file wp-config.php" :-) )

That guide is probably pretty old now though, but anyone can contribute/edit to improve docs. Here's how:
https://docs.wordops.net/about/contributing/#improve-documentation

As a side note, for small sites it's probably easier to use a migration plugin (e.g. 'All in one WP migration', or Migrate Guru etc). Basically - 1. export a full site backup, 2. point your local hosts file to the new server IP, 3. import the backup.

make sure both wp-config has same table prefix and dont transfer wp-config

Hosted by VirtuBox