Are you wondering how to duplicate your WordPress database using phpMyAdmin?
Whether you are looking to set up a web development environment or transfer your site to a new host, you will need to learn how to duplicate your WordPress database. If you are a beginner, the easiest way to do this is with phpMyAdmin, which is a web application for managing databases.
In this guide, we will walk you through the step-by-step process of duplicating your WordPress database using phpMyAdmin.
Expert Tip: Looking for an easy way to duplicate your entire website, including its database, plugins, themes, content, and files? Just check out our guide on how to clone a WordPress site with the Duplicator plugin.
Why Should You Use phpMyAdmin to Duplicate WordPress Database?
phpMyAdmin is a web application that helps website owners manage their databases.
Essentially, WordPress stores all your website content in a database. If you use a WordPress hosting service, then your data is most likely stored and organized in a MySQL database.
The thing is, to interact with MySQL, you will typically need to be familiar with command-line tools, which can be difficult if you are a beginner.
This is where phpMyAdmin comes in. It has a user-friendly interface that lets you do various database-related tasks without having to write complex commands, such as duplicating your WordPress database. Other than that, you can use it to:
- Reset your WordPress admin password if you forget it
- Move your WordPress site to a new web hosting server
- Deactivate plugins if you can’t access your WordPress dashboard
With that in mind, let’s take a look at how to duplicate a WordPress database using phpMyAdmin. We will cover different methods, and you can use the links below to quickly jump to each one:
Method 1: Cloning Your WordPress Database With phpMyAdmin
This method is suitable if you want to manually create a backup or set up a staging environment for testing updates and changes.
First, you need to open your WordPress hosting control panel. In our tutorial, we are working with Bluehost, which uses cPanel for its hosting account management. Your control panel may look slightly different from our screenshots, but the steps will be similar.
Once you are logged in to cPanel, simply find the phpMyAdmin icon. It’s usually inside the ‘Databases’ section.
Now, you are inside your web hosting’s phpMyAdmin. Here, just click the ‘Databases’ tab at the top and select your WordPress database from the list of databases.
If you are not sure what your database name is, it’s the name you input when you first installed WordPress. You can also find it in your wp-config.php file if you forget.
Next, you will see a list of your WordPress database tables.
On this page, just click on the ‘Operations’ tab from the top menu.
This is where you will duplicate your database. Go ahead and scroll down to a section called ‘Copy database to.’
In the empty field, simply write the new database name. Then, make sure the ‘Structure and data’ box is checked. This option will copy both the structure and data of the database.
Additionally, the ‘CREATE DATABASE before copying’ option should be ticked. This will automatically create a new database where the duplicated data will be located.
The rest of the settings can be left as is. All you need to do next is click ‘Go’ at the bottom.
And that’s it! Your database has been successfully cloned.
After this, you can navigate to your newly duplicated database from the left panel.
Method 2: Exporting and Importing WordPress Database With phpMyAdmin
This second method is best if your hosting company does not allow users to create databases directly from phpMyAdmin. This may be the case if you are using shared hosting services where certain privileges are restricted for security reasons.
In this situation, you may not be able to see the ‘Copy database to’ section in the ‘Operations’ tab. To duplicate your database, you can use the export method instead.
Essentially, you will export your database SQL file, set up a new database, and then import that database into the new setup.
The first step is to visit phpMyAdmin and select your WordPress database like we did in the previous method. Then, in the top menu, simply click the ‘Export’ button.
Here, you need to select ‘Custom – display all possible options’ in the ‘Export method’ section.
Once done, just scroll to the Output section and choose the ‘Save output to a file’ option. This will make sure that your database is exported as an SQL file.
For the rest of the settings, you can leave them as they are.
Now, all you have to do is scroll down to the bottom and click ‘Export.’
Your browser will now download the WordPress database as an .sql file.
Next, you need to create a new database where you can import this file to.
Go ahead and open your hosting control panel and click on ‘MySQL Databases.’
On this page, you need to fill out your new database name. In our example, we used _copy
after the original database name to differentiate the old name from the newly duplicated one.
After that, just click the ‘Create Database’ button.
Now that we’ve created a new database, let’s assign it to a MySQL user.
Go ahead and scroll down the ‘Add User to Database’ section and select a MySQL username from the dropdown menu. Make sure to choose the new database you’ve just created in the ‘Database’ field.
Once done, click ‘Add.’
You will now be redirected to the ‘Manage User Privileges’ page.
Simply check the ‘ALL PRIVILEGES’ option if you want to have total control over your database.
Then, go all the way down to the bottom of the page and click ‘Make Changes.’
Your newly created database is now ready.
Let’s go ahead and open phpMyAdmin again and select the database you just created in cPanel.
Once inside, you’ll see that the database is empty without tables like this:
To continue, simply go to the ‘Import’ page from the top menu.
Here, click on the ‘Choose File’ button to select the .sql file you downloaded earlier.
Once finished, scroll down to the bottom and click the ‘Import’ button.
phpMyAdmin will now upload the file from your computer and import your database.
And that’s all! You have successfully imported your duplicated database.
Bonus: Optimize Your WordPress Database for Better Performance
Managing the behind-the-scenes part of your WordPress website is just as important as how it looks on the outside. How you handle your database affects how fast your site loads, how secure it is, and how easily people can use it.
If your database is cluttered with unnecessary data, it can slow down your site and make it vulnerable to security risks. Regularly optimizing your database can prevent this from happening and make your website more reliable.
For more information about database management, you can see our beginner’s guide on managing a WordPress database with phpMyAdmin and our article on how to optimize your WordPress database with one click.
We hope this article has helped you learn how to duplicate a WordPress database using phpMyAdmin. You may also want to see our expert pick of the best WordPress database management plugins and our tutorial on how to fix the establishing a database connection error in WordPress.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
The post How to Duplicate WordPress Database Using phpMyAdmin first appeared on WPBeginner.
Dr Crash says: