The word Export or Import database could be somehow too technical for the new guy in web Dev world. Many people don’t even know where the database is located or how to even access it or what it really is. But since we all need to learn, that’s what this video is for.
Previously I wrote an article about how to create a Database and access it in PHPMyAdmin*** And so today, we’ll be talking about how to import/export databases.
The first thing to do is if you aren’t able or unfamiliar with the PHPMyAdmin, you can read my intro to PHPMyAdmin here**** to get you kick started. But here, I’ll take the task one after the other. So…
The text is a guideline for the video so watch and read to get better understanding of the MySQL database.
#1. Exporting Database
To export your database tables or a table, all you need to do is simple. Firstly, login to your Dashboard (C-Panel or Your Webpabel if Dreamhost) and then look around for your MYSQL or Database area.
If you use Dreamhost, you can find that under the collapsible Menu Goodie >> Manage Database. In IPage, click on MySQL databases and then look for the exact database you want to work with.
Assuming you had created a database with the Name “MyTestDB” then hover on it and when the PHPMyAdmin option shows, click on it.
In the case of Dreamhost, that is already set in front of the database so you don’t need hovering. Ones you are logged in or your Database structures shows up, simply look for the exact table you want to export and then click in it.
Bit assuming you want to move your website to another server and needs your database, then you might want to check all tables without omitting any of them.
Now, the next thing is look for the export button and then click it. Depending in your client, you might be prompted where you want to export the database.
Note: Before you flick on Export button, you need to first of all click on the type of file you wanna save the database with. You could save it as a “.SQL” file or “.ZIP” or any other format presented to you depending in your host’s file manager.
But remember that the .SQL file is the raw file of the MySQL database while the .zip us the compressed version. The key reason for compression is that many database importer won’t allow you to import more than a set value e.g “8mb” so exporting a very large .SQL database could be useless so you’ll need it compressed.
2. Importing Database
Now, assuming you have created your http://www.sample.com website a host and you want to move it back to your new host server, this is what the importation does.
Rather than having to restart the months or weeks of development just to suit your very need. Aside from Drupal or WordPress or any other CMS, there are some scripts that doesnt allow or are unable to create databases all by themselves during installation and so you might be needing to import in those tables into a new database or an empty one and point it to the Config.php files of those scripts.
But either way, our main focus here would be importing the database. So all you need to do just you’ve done before is look for the import Tab and then click on it.
After that, you’ll see the new interface where you can simply browse the directory where you’ve uploaded your exported database.
Now, click in it and then click on the go button. After waiting for some moments depending on your network’s speed, you should see a green success above the page and so to confirm the importation, click on the Browse button and then see your tables.
In some other cases, you might want to import a database table into an existing database let’s take for example, sometimes while working on a new WordPress install, I initially installed the mailpoet plugin but later deleted it for mailchimp.
Later on, I decided to have them both together to experiment but because I have deleted all the tables of the Mailpoet from my database, I couldn’t do anything.
Mailpoets can’t recreate another table so I had to export those mailpoet tables from my localhost WordPress install and then uploaded them into my existing server new WordPress.
So if you want to do something like that, you just need to be able to locate where exactly to import that or those tables and then import it directly in there with the click of the Import button rather than using the import tab which serves as the interface for bulk importing.
Like the Mailpoet databases, they are all in the open table like every other WordPress tables rather than being in the WP_Option table (WP_ ) is just a prefix.
So now you can just try that and get more familiarity with the PHPMyAdmin interface as it would help your relationship with your database.
Secure your database tables with powerful passwords because your website can be hacked straight from the DB and not necessarily from the website administrative panel itself.