Mastering phpMyAdmin 3.3.x for Effective MySQL Management
上QQ阅读APP看书,第一时间看更新

Chapter 6. Exporting Structure and Data (Backup)

Keeping good backups is crucial to a project. Backups consist of up-to-date backups and intermediary snapshots taken during development and production phases. The export feature of phpMyAdmin can generate backups, and can also be used to send data to other applications.

Note

Please note that phpMyAdmin's export feature produces backups on-demand and it's highly recommended to implement an automatic and scripted backup solution that takes backups on a regular schedule. The precise way to implement such a solution depends on the server's OS.

Dumps, backups, and exports

Let's first clarify some vocabulary. In the MySQL documentation, you will encounter the term dump, and in other applications, the term backup or export. All of these terms have the same meaning in the context of phpMyAdmin.

MySQL includes mysqldump—a command-line utility that can be used to generate export files. But the shell access needed for command-line utilities is not offered by every host provider. Also, access to the export feature from within the Web interface is more convenient. This is why phpMyAdmin offers the export feature with more export formats than mysqldump. This chapter will focus on phpMyAdmin's export features.

Before starting an export, we must have a clear picture of the intended goal of the export. The following questions may be of help:

  • Do we need the complete database or just some tables?
  • Do we need just the structure, just the data, or both?
  • Which utility will be used to import the data back in?
  • Do we want only a subset of the data?
  • What is the size of the intended export, and the link speed between us and the server?

Scope of the export

When we click an Export link from phpMyAdmin, we can be in one of the following views or contexts: Database view, Table view, or Server view (more on this later in Chapter 19, Administrating the MySQL Server with phpMyAdmin). According to the current context, the resulting export's scope will be a complete database, a single table, or even a multi-database export as in the case of Server view. We will first explain database exports and all of the relevant export types. Then we'll go on with table and multi-database exports, underlining the difference for these modes of exporting.