WordPress Odd migration issue

You didn’t mention what have you done so far to migrate your installation, but I’m going to write the full procedure.

Backing Up the Old Database

You need to create an exact duplicate of your database, to transfer it to your new server. There might be an encoding issue here, so to do this, login into your panel’s PhpMyAdmin, and then:

  1. Select the database’s name from the left sidebar
  2. Click the Export button on the top navigation menu
  3. Click Custom under export method
  4. Click Select All under the tables
  5. Choose UTF-8 as encoding, as stated in the screenshot below

Exporting WordPress database

Now you can export and save the file.

Restoring the Back-up

To restore the backup, you should first create a database with the same name of your previous database. After you did so, choose it from the left sidebar, and click Import from the top navigation menu. Choose the file by clicking the browse button, and then set the encoding to UTF-8.

Click Import to finish the importing (don’t forget to remove any existing tables first).

Editing wp-config.php

After importing the database, you need to modify the wp-config.php file. If you don’t do this, you will be redirected to an installation page, this is why you are getting “Table Exists” error instead of directly being redirected to wp-login.php.

These 4 lines need to be modified to match your new database’s configuration:

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

/** MySQL database username */
define('DB_USER', 'username');

/** MySQL database password */
define('DB_PASSWORD', 'password');

/** MySQL hostname */
define('DB_HOST', 'localhost');

If you do this properly, you will be redirected to wp-login.php after you try to access /wp-admin/.

Updating the URLs

If you have also changed your domain’s address, you need to take 2 further steps. First, you should update the core URLs for your blog’s home page. To do so, open the wp_options table in PhpMyAdmin, and modify the siteurl and home values to match your new domain. These are the first two options.

Afterward, you have to do a full search and replace in your database to update the old URLs. Since there are serialized data in the database, you should avoid doing this by a plain text editor. Instead, use a plugin such as Better Search Replace.

Head over to Tools > Better Search Replace, and replace old.com with new.com. Pay attention to spelling and letter cases, this can matter a lot. If you are switching to HTTPS, you should replace http://old.com with https://new.com.

A Final Note

I would also use the same WordPress version on the old server for migration. After migrating, you can update to the latest version in the admin panel.