Base de connaissances

Catégories

Catégories

Exporting databases and tables with phpMyAdmin

This tutorial is to teach you how to export databases and tables with phpMyAdmin. We will assume that you are currently logged into phpMyAdmin, and for the purpose of this tutorial, we will use a database with two tables as our example. The phpMyAdmin main screen is broken into two sections. The left hand side is blue, and this is where you will find your database listed. Below the database, you will see the names of the tables that are in the database. The right hand side is a large white window, and this is where the activity takes place.

Let's start learning how to export tables and databases. To export a database, the first step is to click on it in the left hand panel. This will open the right hand panel to a screen showing the details of the database. Now, from the menu at the top of the right hand side, click on the Export button. This will open up a new screen, called View dump (schema) of database. There are many options listed for exporting the database. One option is to export the entire database in SQL format, so that it can easily be imported later. This is an excellent way to back-up your database. To use this option, scroll down almost to the bottom of the box. On the left hand side, you will see a radio button and the letters SQL. Click on this. Make sure you go back to the top of the box and check any options you want before you move on with the export. For example, you might wish to uncheck or check things like : Add Auto_Increment Value, or Add Into Comments, Creation/Update/Check Dates.

When you are ready, scroll down, and check the Save as file box. Then click the Go button. You will get a pop-up asking you what to do with the file that you have chosen to open. Save to disk should be checked. Click on OK. That completes the export. The database has now been exported to your local computer.

If you only want to export a table, begin by clicking on the table name in the left hand side. That will open a window showing the table details on the right hand side. Again, click on the Export button from the menu at the top of the window. That will open the View dump (schema) of table screen. You are going to check the SQL again, and make sure all the options you wish to mark are checked. Scroll to the bottom, and click on the Save as file. Then click on Go. The pop-up will ask what you want to do with the file. Save to Disk should be checked. Click on OK. That completes the export of the table. It has now been exported to your local computer.

Remember that exporting a database will export all the tables, providing they are all selected, but exporting tables only exports the selected table from within a database. This ends this tutorial. You now know how to export databases and tables to your local computer using phpMyAdmin.