In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
A simple mysql full backup script that backs up data from the last 15 days.
Backup
# backup the mysql database every day (save the data script for the last 15 days)
DATE=$ (date +% Y%m%d)
/ home/cuixiaohuan/lamp/mysql5/bin/mysqldump-uuser-ppassword need_db > / home/cuixiaohuan/bak_sql/mysql_dbxx_$DATE.sql
Find / home/cuixiaohuan/bak_sql/-mtime + 15-name'* .sql'- exec rm-rf {}\
Restore
Mysql data Import
Drop databases need_db
Create databases need_db
Import data: encoding must be set for recovery
. / mysql-uroot-p-- default-character-set=utf8 need_db
< xx.sql 知识点扩展: 使用 mysqldump 备份与恢复 1. 备份原理 mysqldump 备份原理比较简单,先查出需要备份的表结构,在文本文件中生成一个 create 语句;然后将表中的所有数据记录转换成一条 insert 语句;通过这些语句就能够创建表并插入数据。 2. 备份一个数据库 基本语法: >> mysqldump-u username-p dbname table1 table2... > BackupName.sql
An example shows:
Mysqldump-u root-p test person > / tmp/backup.sql
3. Back up multiple databases
Basic syntax:
Mysqldump-u username-p-- databases dbname2 dbname2 > BackupName.sql
An example shows:
Mysqldump-u root-p-- databases test mysql > / tmp/backup.sql
4. Back up all databases
Basic syntax:
Mysqldump-u username-p-all-databases > BackupName.sql
An example shows:
Mysqldump-u-root-p-all-databases > / tmp/all.sql
5. Data recovery
Basic syntax:
Mysql-u root-p [dbname] < backup.sql
An example shows:
Mysql-u root-p < / tmp/backup.sql
These are the details of mysql full backup and fast recovery methods. For more information about mysql simple full backup and fast recovery methods, please pay attention to other related articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.