mysqldumpprogram creates an archive in theform of a (Database web hosting)

mysqldumpprogram creates an archive in theform of a series of SQL commands that will re-createthe data should you restore from the archive. Asmysqldumpprocesses each table, it writes a CREATETABLEcommand to re-create the table and all indexesdefined for that table. Then it writes an INSERTcom- mand for each row in the table. Listing 44-1 shows a snippet from a typical mysqldumparchive. LISTING44-1: MYSQLDUMPARCHIVE… — – Table structure for table `customer` — CREATE TABLE customer ( id int(11) NOT NULL default 0 , name varchar(40) default NULL, address varchar(40) default NULL, city varchar(40) default NULL, state varchar(20) default NULL, zip varchar(9) default NULL, PRIMARY KEY (id), KEY cc_name (name), KEY cc_city_state (city,state) ) TYPE=MyISAM; — – Dumping data for table `customer` — INSERT INTO customer VALUES (1, TrixieWare , 200 Snack Street , Beltsville , MD , 25525 ); INSERT INTO customer VALUES (2, FranklinBooks , 157 Literary Ave. , Seattle , WA , 97745 ); … mysqldump backup optionsThe mysqldumpcommand supports a variety of com- mand line options, many of which affect the formatof the data in the archive itself. One particularlyChoosing a Method to Back UpMySQL DataArchiving (or backing up) the data in a MySQL data- base can be a bit tricky. The archive method thatyou choose is primarily influenced by three factors: Database availability (hot-backup or shutdown) Table type (MyISAM, InnoDB, and so on) Archive sizeIf your database must be online 24/7, you must use ahot-backup technique. If you can afford to take yourMySQL server down for a while, you can use a file- system backup technique. If you can take your server offline, you can use normalfilesystem backup tools (like tar). If you need to use ahot-backup technique, you can use mysqlhotcopyormysqldump. Or, for the ultimate in availability, use repli- cation to archive your data. We explain how each ofthese backup tools works in the sections that follow. Backing Up and RestoringwithmysqldumpTo back up a table using mysqldump, follow these steps: 1.Open a terminal window. 2.Execute the following command: $ mysqldump database> backup.sqlReplace databasewith the name of the databasethat you want to archive. 3.Copy the resulting file (backup.sql) to CD (ortape) or move it to a different host to safeguardthe data.
We would like to recommend you tested and proved virtual web hosting services, which you will surely find to be of great quality.

Leave a Reply