Method 1: Suitable for mysql databases in all formats. It is regularly executed by exporting and importing a script to the database:
1. Export mysqldump-u username-p database Name> exported file name mysqldump-u username-p database> url/databas. SQL
2. Export a table mysqldump-u user name-p database name Table Name> exported file name mysqldump-u username-p database users> url/users. SQL
3. Export a database structure mysqldump-u username-p-d -- add-drop-table database> url/database. SQL
Definition:
-D no data
-- Add-drop-table: add a drop table before each create statement.
4. Run the source command to import the database to the mysql Database Console:
For example, mysql-u root-p mysql> use Database
Method 2: For mysql Data Tables in the format of MyISAM
Assume that the data file is in/var/lib/mysql
Write a script directly.
Cp-r/var/lib/mysql/directory to which the backup is saved
Remote backup incremental with rsync or regular full backup
Author: "net ljx blog"