Importing wordpress database

Hi

I installed wordpress via the installer which automatically created a database. I then went into myphp and imported mysql backup into the created database. However, I am unable to see any of my posts in the wordpress panel.

my website- www.bizzntech.com

Could you please let me know what I am doing wrong here? Once I have sorted this then I can go about importing my theme files, etc.

Thanks

When WordPress sets up a database, it creates a so-called Table Prefix. This is a word like wpXXX_, which is added in front of all database table names, and is a way to have multiple WordPress installations in a single database.

If you imported a backup from another site into the database of another installation, the table prefix doesn’t match. Because of that, your database will probably have two WordPress installations in it: the clean installation from Softaculous and the backup you imported.

Fortunately, you can fix this by changing the table prefix in the WordPress configuration.

Start by opening the wp-config.php file of your site (for example through the file manager), and by opening phpMyAdmin in another tab. In the wp-config.php file, look for the text $table_prefix. There should be a value like wpXXX there.

Then, in phpMyAdmin, you should see that half of the table names start with that prefix, and the other half have another prefix. This is the prefix of the installation you backed up.

Then go back to the wp-config.php file and replace the value of the table_prefix with the other prefix you found in phpMyAdmin. Then, save the file, and try opening your website again.


And, as a bit of general advice: next time, you may want to make sure you backup both the files and the databases. As you can see, you can transplant a database to another installation, but moving a full installation can be easier (and also includes any plugins and themes).

8 Likes

Many thanks for this.
Im going to jump to your second point. I have actually got the whole backup of the directory plus mysql. How does it become easier to transfer the whole backup? (from a database perspective). I guess you are saying it creates a perfect clone.

I initially tried copying tar. Gz of the backup but for some reason the file manager didn’t extract it and brought up an error. I read the forums and thought this was due to the upgrades that were taking place.

I will try again tomorrow and give you an update.

Thanks

Make sure that the file does not exceed 10 MB so you could upload it. And also you can only upload 1 MB of php and html file.

3 Likes

Easier may not be the correct phrase to use. Like you said, it’s a perfect clone, so it may be easier if you want to completely replicate a website including all plugins, themes and uploads. If you only transfer the database, restoring the plugins and themes can be a bit tricky and lead to some data corruption.

The most reliable way is to extract the archive on your computer and upload the extracted files with FileZilla. It will take a while, but it will work. The file manager tends to choke on large archives, so that’s may not work if you’re trying to restore a full website backup.

4 Likes

Thank you everyone for your help. I have managed to get the site up and running now.
Appreciate it!

1 Like

Don’t forget to mark this topic as solved!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.