The "Export" function is useful for obtaining backups of our database (we recall that this is also possible to do from the administration panel of PHP-Nuke, see Section 7.1). The management console we get for this function is quite detailed (Figure 3-11):
In the central area, we have a list of the database tables, while to the right we have the backup options:
-
Structure only: backs up the structure of the database (tables, their fields and their properties), but not the data it contains (i.e. the tables are left empty).
-
Structure and data: will save not only the structure, as above, but the data in the tables as well.
-
Data only: will save only the data, but not the structure.
-
XML: saves the database in an XML format.
The options that appear in the lower part of the screen have to do with the extra features the created backup file should have:
-
Add 'Drop Table': Prepends an instruction to destroy any existing table with that name to the instructions that create that table. For example, if we already have a table "nuke_authors" in our
database, this option will take care of removing it, before it loads the structure and/or data for a table with the same name. Otherwise, attempting to import a file that contains structure and/or
data for nuke_authors will result in an error, since the table will already exist. You should check this option if you are reinstalling PHP-Nuke over a previous
unsuccessful instalation and you think you might already have some tables there.
-
Save as file: will save the backup as a file (which will be compressed accordingly, with either ZIP or GZIP, if the "zipped" or "gzipped" boxes are checked - other versions of phpMyAdmin may only
offer a "bzip" compression).
If we don't select any table from the table list, phpMyAdmin will deduce that we want to save all tables. In case you want to select only some of them, just click on the ones you want with the
left mouse button, keeping the CTRL button pressed.
To export a database from the command-line, without the use of the graphical tool of phpMyAdmin, you just do:
mysqldump -u dbuser -h dbhost -p dbname > dbdump.sql
|
where dbuser, dbhost and dbname are the database user, host and name respectively, exactly as entered in config.php (Section 3.7).