Browsing this Thread:   1 Anonymous Users






mysql 备份压缩
#1
Just can't stay away
Just can't stay away


See User information
mysql 备份压缩

#!/bin/bash


BACKUP_TIME=`date +%Y%m%d%H%M`
BACKUP_PATH="/data/backup.files/sql"
BACKUP_FILE="$BACKUP_PATH/edatao.$BACKUP_TIME.sql.tar.bz2"


find $BACKUP_PATH -iname "*.sql.tar.bz2" -type f -mtime +10 -exec rm {} ;

mysqldump --skip-lock-tables -h 127.0.0.1 -uuser_name -puser_pass   dbname bzip2 $BACKUP_FILE



mysql 压缩文件导入:
for file.sql.gz
zcat /path/to/file.sql.gz mysql -'root' -p your_database




For bzip2 compressed files (.sql.bz2), use:


bzcat <file> | mysql -<user> -<database>

or
pv <file> | bunzip2 mysql -<user> -<database>





Posted on: 2021/10/28 14:04

Edited by eyex on 2021/12/3 14:25:09
Edited by eyex on 2021/12/3 14:25:28
Edited by eyex on 2021/12/8 16:02:55
Edited by eyex on 2023/8/20 19:09:32
Top








friend links
Themes

(2 themes)
Login
Username:

Password:


Lost Password?
Register now!
Categories
Xoops (11)
--Modules (2)
--Themes (0)
Article (8)