user name-p database name> exported file name mysqldump-u wcnc-p smgp_1__wcnc>/storage path/wcnc. SQL2. export a table mysqldump-u user name-p database name table name> exported file name mysqldump-u wcnc-p smgp_rj_wcnc users>/storage path/wcnc_users. SQL3. export a database structure mysqldump-u wcnc-p-d -- add-drop-table smgp_rj_wcnc>/storage path/wcnc_db. SQLDefinition:-D no data-- Add-drop-table: add a drop table before each create statement.4. run the source command to import the database
forms of MySQL database, through the database export to write a script timed execution:1. Export the entire database mysqldump-u user name-p database name > exported file name mysqldump-u wcnc-p SMGP_APPS_WCNC >/store Path/wcnc.sql2. Export a table mysqldump-u user name-P database name table name > exported filename mysqldump-u wcnc-p smgp_apps_wcnc users>/store Path/wcnc_users.sql3. Export a database structure mysqldump-u wcnc-p-D--add-drop-table sm
name-p database name Table Name> exported file name mysqldump-u wcnc-p smgp_rj_wcnc users>/storage path/wcnc_users. SQL3. Export a database structure mysqldump-u wcnc-p-d -- add-drop-table smgp_rj_wcnc>/storage path/wcnc_db. SQLDefinition:-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 DatabaseMethod 2: For mysql Data Tables in the format of MyISAMAssu
Intended audience
This article is tested in linux and mysql 4.1.14. After modification, it may be applicable to mysql 4.0, 5.0 and other versions.
This article is applicable to mysql that does not enable replication. If replication is started, you may not need to adopt this backup policy or modify relevant parameters.
Each person may have different backup policies. Therefore, Please modify the policies base
Xtrabackup automatic backup script and xtrabackup script
# Backup. sh #! /Bin/sh # on xtrabackup 2.2.8 # When you execute it for the first time, it will check whether there is a full backup. Otherwise, create a full database backup
Mysql daily backup and incremental backup script bitsCN.com
INTENDED AUDIENCE
This article is tested in linux and mysql 4.1.14. after modification, it may be applicable to mysql 4.0, 5.0 and other versions.
This article is applicable to mysql that does not enable replication. If replication is started, you may not need to adopt this
Preparations: lftp must be installed in VPS in advance. lftp is powerful. CentOS directly executes: yuminstalllftp and Debian execute: apt-getinstalllftp. You need to create the/home/backup/directory on VPS and the backup directory on FTP. If there are not many VPS databases, you can use Godaddy free space (10 GB space, 300
Preparations:
Lftp needs to be installed in VPS in advance. lftp is powerful and can
Preparatory work:
Need to advance in the VPS to install good lftp,lftp function more powerful, CentOS Direct execution: Yum install Lftp,debian execution: Apt-get install.
You need to create the/home/backup/directory on the VPS and create the backup directory on FTP.
If the VPS on the database is not much to use GoDaddy free space can (10GB space, 300GB traffic), as long as the registration of the domain
: bakwww.sh file must have the permission to execute!LINUX Automatic backup script filesFirst I set up a folder under the/root/backup directory,#mkdir/root/backup/mysqlbackupLater at five o'clock every day, there will be a file saved here.Then create a new file#vim/root/mysqlautobakInput:Filename= ' Date +%y%m%d 'mysql
Mysql backup policies can be divided into four types:
1) directly copy database files (not recommended)
2) use mysqlhotcopy to back up the database
3) Use mysqldump to back up the database
4) use the master-slave replication mechanism (for real-time database backup)
Mysqldump is widely used and easy to operate. The following describes the mysqldump backup policy.
Mysql backup script and delete the backup file bitsCN.com from the previous five days
USER = root # Database username
PASSWORD = cucrzmysql # database user PASSWORD
# DATABASE = idssr # DATABASE name
For DATABASE in 'ls/mysql/data/mysql/| grep idss' # DATABASE name
Do
# WEBMASTER = 849699940@qq.com # administrator email address to send
Tags: blank database target MySQL periodichttp://hongge.blog.51cto.com/ Backups of MySQL databases in a production environment are recurring operations, so it is common to write script implementations that periodically execute backup scripts through Crond scheduled tasks mysqldump Backup scenarios: Sunday 1 o'clock in the morning full-Library
First modify the script for necessary configuration, and then run it as the root user. 1. first, the first parameter is used for remote backup. 2. local parameter for local backup 3. parameter-free remote backup note: you need to add a user to the Mysql user on another host .. where you need to configure: # definehosta
after the measurement product deploys the service end, because the service side has each kind of encapsulation encrypted attachment, the file and so on data, in order to safeguard the security of the information, in addition to establish the high availability backup mechanism, we can through the batch script, unifies to the system plan to carry on the local or the offsite
Today an accident, I wrote the diary of the big half month the encrypted file is damaged and cannot be recovered. He decided to write a dedicated backup script file.
The main idea is to create a folder under current directory backup based on today's date, and then copy the files to that folder.
The script files are as
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.