当前位置:网站首页>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
边栏推荐
- Operators in C language
- Stanford machine learning course summary
- Generate verification code
- Box pointer of rust
- 硬核解析Promise對象(這七個必會的常用API和七個關鍵問題你都了解嗎?)
- Identification verification code
- Calculation of fishing net road density
- re正則錶達式
- idea中安装YapiUpload 插件将api接口上传到yapi文档上
- Matlab tips (6) comparison of seven filtering methods
猜你喜欢

函数递归以及趣味问题的解决

Calculation of fishing net road density

多功能工具箱微信小程序源码

【ACM】70. climb stairs
![解决报错max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]](/img/5f/a80951777a0473fcaa685cd6a8e5dd.png)
解决报错max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

Vulnérabilité d'exécution de la commande de fond du panneau de commande JD - freefuck

Using files to save data (C language)

Install the yapiupload plug-in in idea and upload the API interface to the Yapi document
![[UDS unified diagnostic service] v. diagnostic application example: Flash bootloader](/img/45/f9e24ae1c619f78aeeb7bcf12d6e5f.png)
[UDS unified diagnostic service] v. diagnostic application example: Flash bootloader

Implementation of k8s redis one master multi slave dynamic capacity expansion
随机推荐
Qtablewidget usage explanation
From introduction to mastery of MATLAB (2)
Process management command
Closure type of rust (difference between FN, fnmut and fnone)
C language input and output (printf and scanf functions, putchar and getchar functions)
Solution to Chinese garbled code after reg file is imported into the registry
JD-FreeFuck 京東薅羊毛控制面板 後臺命令執行漏洞
Romance in C language
Install the yapiupload plug-in in idea and upload the API interface to the Yapi document
Mode of interprocess communication
Docker installation MySQL
Nodejs installation
The vivado project corresponding to the board is generated by TCL script
SSD硬盘SATA接口和M.2接口区别(详细)总结
Solving the problem of displaying too many unique values in ArcGIS partition statistics failed
PowerDesigner various font settings; Preview font setting; SQL font settings
Feign requests the log to be printed uniformly
Docker 安装 Redis
【ACM】455. Distribute Biscuits (1. Give priority to big biscuits to big appetite; 2. Traverse two arrays with only one for loop (use subscript index -- to traverse another array))
.105Location