customer.frm: Contains the metadata for (Apache web server) thecustomertable (that is,
customer.frm: Contains the metadata for thecustomertable (that is, the table, column, andindex definitions) customer.MYD: Contains the rows in the customertable customer.MYI: Contains the indexes defined forthe customertable (if any) You can back up an entire database by archiving thefiles in the database directory. For example, use thefollowing command to create a file system backup ofthe acctgdatabase: $ tar -zcvf acctg.tgz /var/lib/mysql/acctgRemember to be safe and shut down your MySQLserver before you copy the table files. If you can tshut down your MySQL server on a regu- lar basis, you can still use file system archive tools, but you have to ensure that the tables that you rebacking up are not being modified at the time youarchive them. Making a mysqlhotcopyofYourDatabaseThe mysqlhotcopyprogram creates a copy of MyISAMtable files from a running server. When mysqlhotcopyarchives a table, it acquires a READlock on the table, creates a copy of the table s data files, and thenreleases the READlock. The READlock preventsupdates but allows other users to read the table atthe same time. To back up the acctgdatabase using mysqlhotcopy, use the following command: $ mysqlhotcopy acctgThe table files are copied to a directory named/var/lib/mysql/acct_copy. You can use a file systemarchive tool to back up the copy. Restoring a mysqldump archiveAfter you ve created an archive with mysqldump, it seasy to restore your data if something goes wrong. Because mysqldumpcreated an SQL script for you, allyou have to do to recover lost data is to run the script. For example, if you ve created an archive namedbackup.sql, simply feed that script back into themysqlclient, like this: $ mysql database < backup.sqlNote that you must provide a databasename if youarchived a single database. If you back up multiple databases in the samearchive file with the --all-databasesoption or the --databasesoption, you don t have to specify a data- base when you restore (the database names arestored in the archive). To restore from a compressed archive, use the zcatprogram to decompress the script and pipe the resultinto mysql: $ zcat backup.sql.gz | mysql databaseIf you normally back up your data to CD orDVD, see Technique 50 for a handy way tostream your MySQL archive directly onto a setof one or more discs. Backing Up with FileSystemToolsIf you can afford to take your MySQL server offlineoccasionally, you can use normal Linux backup tools, such as tarand gzip. (See Technique 50 for informa- tion about using file system backup tools to archiveyour data.) MySQL tables are stored in normal file system datafiles. If you have a MyISAM table named customer(ina database named acctg), you see three customer- related files in /var/lib/mysql/acctg:
Searching for affordable and proven webhost to host and run your servlet applications? Go to Linux Web Hosting services and you will find it.