当前位置:网站首页>Mysqldump backup database
Mysqldump backup database
2022-04-23 18:14:00 【The hunter is eating meat】
Backup
Backup myBlog database .
myBlog_back.sh:
#!/bin/bash
currentDate=$(date "+%F")
currentTime=$(date "+%Y-%m-%d_%H_%M_%S")
build_dir="/opt/db/myBlog/${currentDate}"
echo ${build_dir}
if [ ! -d "${build_dir}" ]; then
mkdir -p ${build_dir}
echo ' Directory created '
fi
/mysql/bin/mysqldump --defaults-extra-file="/opt/.mysqldump_myBlog.cnf" myBlog > ${build_dir}/myBlog_${currentTime}.sql
echo " Export succeeded "
.mysqldump_myBlog.cnf:
[client]
host='192.168.0.1'
user=root
## If the password contains special characters , Must be enclosed in quotation marks , Otherwise, you can omit
password='root'
port=3306
Restore data
## Log in to the database
mysql > mysql -uroot -p
mysql > # Input password
## Create database
mysql > create database `myBlog` default character set utf8 collate utf8_general_ci;
## Switch database
mysql > use myBlog;
## Import data
mysql > source /opt/db/myBlog/2021-03-14/myBlog_2021-03-14_21_40_01.sql
版权声明
本文为[The hunter is eating meat]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210611118218.html
边栏推荐
- xlsxwriter. exceptions. Filecreateerror: [errno 13] permission denied
- Rewrite four functions such as StrCmp in C language
- Gobang game based on pyGame Library
- Robocode Tutorial 4 - robocode's game physics
- 7-21 wrong questions involve knowledge points.
- 解决报错max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
- C language array processing batch data
- re正則錶達式
- Mode of interprocess communication
- Array rotation
猜你喜欢

深度学习经典网络解析目标检测篇(一):R-CNN

解决允许在postman中写入注释请求接口方法

Data stream encryption and decryption of C

Analysez l'objet promise avec le noyau dur (Connaissez - vous les sept API communes obligatoires et les sept questions clés?)

Spark performance optimization guide

Installation du docker redis

Dynamically add default fusing rules to feign client based on sentinel + Nacos

powerdesigner各种字体设置;preview字体设置;sql字体设置

Calculation of fishing net road density

Win1远程出现“这可能是由于credssp加密oracle修正”解决办法
随机推荐
RC smart pointer in rust
Rust: shared variable in thread pool
I/O多路复用及其相关详解
线上怎么确定期货账户安全的?
Analysez l'objet promise avec le noyau dur (Connaissez - vous les sept API communes obligatoires et les sept questions clés?)
Rust: how to implement a thread pool?
Crawling mobile game website game details and comments (MQ + multithreading)
Implement a simple function to calculate the sum of all integers between M ~ n (m < n)
Docker installation MySQL
Classes and objects
Operators in C language
Robocode tutorial 8 - advanced robot
Gst-launch-1.0 usage notes
xlsxwriter. exceptions. Filecreateerror: [errno 13] permission denied
Yolov4 pruning [with code]
多功能工具箱微信小程序源码
Implementation of object detection case based on SSD
The difference between deep copy and shallow copy
硬核解析Promise對象(這七個必會的常用API和七個關鍵問題你都了解嗎?)
Crack sliding verification code