惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Hugging Face - Blog
Hugging Face - Blog
Jina AI
Jina AI
宝玉的分享
宝玉的分享
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
人人都是产品经理
人人都是产品经理
博客园 - 聂微东
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
J
Java Code Geeks
博客园 - 【当耐特】
小众软件
小众软件
博客园 - Franky
S
SegmentFault 最新的问题
WordPress大学
WordPress大学
雷峰网
雷峰网
The Cloudflare Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
量子位
Last Week in AI
Last Week in AI
博客园_首页
月光博客
月光博客
IT之家
IT之家
阮一峰的网络日志
阮一峰的网络日志
Webroot Blog
Webroot Blog
Stack Overflow Blog
Stack Overflow Blog
腾讯CDC
云风的 BLOG
云风的 BLOG
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
Recent Commits to openclaw:main
Recent Commits to openclaw:main
D
Docker
The Last Watchdog
The Last Watchdog
有赞技术团队
有赞技术团队
Hacker News - Newest:
Hacker News - Newest: "LLM"
D
DataBreaches.Net
S
Security @ Cisco Blogs
Blog — PlanetScale
Blog — PlanetScale
GbyAI
GbyAI
TaoSecurity Blog
TaoSecurity Blog
S
Security Affairs
Y
Y Combinator Blog
O
OpenAI News
罗磊的独立博客
MongoDB | Blog
MongoDB | Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Forbes - Security
Forbes - Security
P
Palo Alto Networks Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
K
Kaspersky official blog
Cloudbric
Cloudbric

WishMeLz - Linux

目标域名在线测试 - WishMeLz NodeBB 搭建安装笔记 v4.x - WishMeLz puppeteer在Linux端 依赖库确实 libdrm.so.2,libnss3.so Linux 工具箱整理 - WishMeLz docker 镜像加速 - WishMeLz Certimate 使用教程 - WishMeLz ip自签名ssl证书 - WishMeLz PM2搭配nvm使用不同版本Node启动项目 - WishMeLz cors-anywhere Nodejs实现静态资源代理,使用ESA加速访问 - WishMeLz
shell脚本备份数据库 - WishMeLz
WishMeLz · 2026-06-01 · via WishMeLz - Linux
 #!/bin/bash

# 设置变量
BACKUP_DIR="/backsql"  # 本地备份目录
MYSQL_USER="user"  # MySQL 用户名
MYSQL_PASSWORD="5CYGfYhjEXE4STY"  # MySQL 密码
MYSQL_HOST="127.0.1"  # MySQL 服务器地址,如果是远程服务器,请修改为相应的IP地址
MYSQL_PORT="22619"  # MySQL 端口号
DATABASE_NAME="detabase"  # 要备份的数据库名称

# 备份文件名格式:数据库名_日期.sql
BACKUP_FILE="$BACKUP_DIR/$DATABASE_NAME_$(date +\%Y-\%m-\%d).sql"

# 创建备份目录(如果不存在)
mkdir -p "$BACKUP_DIR"

# 备份数据库
mysqldump -h "$MYSQL_HOST" -P "$MYSQL_PORT" -u "$MYSQL_USER" --set-gtid-purged=OFF  -p"$MYSQL_PASSWORD" "$DATABASE_NAME" > "$BACKUP_FILE"

# 检查备份是否成功
if [ $? -eq 0 ]; then
    echo "Database backup successful: $BACKUP_FILE"
else
    echo "Database backup failed!" >&2
fi

# 可选:删除超过7天的旧备份
find "$BACKUP_DIR" -type f -name "*.sql" -mtime +7 -exec rm {} \;

日志

mysqldump: [Warning] Using a password on the command line interface can be insecure.
mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces
Database backup successful: /app/backsql/2025-01-16.sql
----------------------------------------------------------------------------
★[2025-01-16 01:00:03] Successful
----------------------------------------------------------------------------
mysqldump: [Warning] Using a password on the command line interface can be insecure.
mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces
Database backup successful: /app/backsql/2025-01-17.sql
----------------------------------------------------------------------------
★[2025-01-17 01:00:03] Successful
----------------------------------------------------------------------------
mysqldump: [Warning] Using a password on the command line interface can be insecure.
mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces
Database backup successful: /app/backsql/2025-01-18.sql
----------------------------------------------------------------------------
★[2025-01-18 01:00:03] Successful
----------------------------------------------------------------------------
mysqldump: [Warning] Using a password on the command line interface can be insecure.
mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces
Database backup successful: /app/backsql/2025-01-19.sql
----------------------------------------------------------------------------
★[2025-01-19 01:00:02] Successful
----------------------------------------------------------------------------
mysqldump: [Warning] Using a password on the command line interface can be insecure.
mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces
Database backup successful: /app/backsql/2025-01-20.sql
----------------------------------------------------------------------------
★[2025-01-20 01:00:02] Successful
----------------------------------------------------------------------------
mysqldump: [Warning] Using a password on the command line interface can be insecure.
mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces
Database backup successful: /app/backsql/2025-01-21.sql
----------------------------------------------------------------------------
★[2025-01-21 01:00:04] Successful
----------------------------------------------------------------------------
mysqldump: [Warning] Using a password on the command line interface can be insecure.
mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces
Database backup successful: /app/backsql/2025-01-22.sql
----------------------------------------------------------------------------
★[2025-01-22 01:00:03] Successful
----------------------------------------------------------------------------

最后编辑时间为: January 22nd , 2025 at 09:45 am
本文由 Wish 创作,采用 知识共享署名 4.0 国际许可协议进行许可
可自由转载、引用,但需署名作者且注明文章出处

标签 : 无标签