Skip to content

Nuface Blog

隨意隨手記 Casual Notes

Menu
  • Home
  • About
  • Services
  • Blog
  • Contact
  • Privacy Policy
  • Login
Menu

Category: Database

About Database

Docker + MariaDB Backup and Restore Best Practices

Posted on 2025-11-052025-11-05 by Rico

This post summarizes best practices for backing up and restoring MariaDB databases running inside Docker containers.It explains different backup strategies, practical command examples, and key considerations to ensure data reliability and consistency in containerized environments. 1. Why Backups Matter for Dockerized Databases When MariaDB runs inside Docker, the actual data resides in volumes or bind-mounted…

Read more

Docker + MariaDB 備份與還原最佳實務

Posted on 2025-11-052025-11-05 by Rico

本文整理在 Docker 環境中執行 MariaDB 的備份與還原最佳實務,說明不同場景下的策略、指令範例與注意事項,協助在容器化環境中維持資料安全與可靠性。 一、為什麼 Docker 化的資料庫要特別注意備份? 在 Docker 架構中,MariaDB 通常以容器形式運行,而容器的資料是存在 volume(資料卷) 或 bind mount(對應主機資料夾) 中。如果只重新建立容器而未備份這些持久資料,整個資料庫會直接遺失。 所以:📌 資料庫備份的重點在於「持久層(persistent data)」與「資料一致性(consistency)」的保存。 二、常見的三種備份方式 備份方式 特點 適用情境 邏輯備份 (mysqldump) 以 SQL 指令匯出結構與資料 較慢但最通用,可跨版本匯入 實體備份 (volume / 資料夾) 直接複製 /var/lib/mysql 內容 快速但需停機,版本必須一致 容器自動備份 (cron + dump) 使用排程在容器內週期性匯出 SQL 自動化備份最常見作法 三、邏輯備份(mysqldump) 這是最穩定、跨版本相容度最高的方式。 🔹 手動匯出備份 📘 重點參數說明 四、自動化排程備份(每日自動 dump) 1️⃣ 建立備份腳本…

Read more

Mysqldump Export Syntax Notes (MySQL / MariaDB 5.5)

Posted on 2025-11-052025-11-05 by Rico

This article summarizes practical usages and command syntax for mysqldump in MySQL / MariaDB 5.5 environments.It covers common export scenarios, important options, and best practices — ideal as a quick reference for backup and restoration tasks. 1. What Is mysqldump? mysqldump is a built-in MySQL/MariaDB utility used to export: The exported result is a plain…

Read more

Mysqldump 匯出語法筆記 (MySQL / MariaDB 5.5)

Posted on 2025-11-052025-11-05 by Rico

本文整理了 MySQL / MariaDB 5.5 環境下 mysqldump 指令的匯出語法與實務建議,適合日後備查與快速套用。主要涵蓋單一資料庫、全部資料庫、部分資料表、交易一致性、編碼設定與壓縮匯出等情境。 一、mysqldump 是什麼? mysqldump 是 MySQL 與 MariaDB 內建的備份工具,用來匯出: 匯出結果為純文字 SQL 檔,可直接使用 mysql 或 mariadb 指令匯入還原。 二、基本匯出語法 匯出單一資料庫 匯出所有資料庫 匯出特定資料表 三、交易一致性與鎖定策略 引數 適用引擎 說明 –single-transaction InnoDB 匯出時不鎖表,資料一致性最佳 –lock-tables MyISAM 匯出前鎖表,避免資料變動 四、常用參數建議 參數 說明 –routines 匯出 Stored Procedures / Functions –events 匯出排程事件 –triggers 匯出觸發器(預設會匯出,但可保險加上) –hex-blob 將 BLOB / TEXT…

Read more

Importing MariaDB SQL Files Inside Docker Containers — Practical Notes

Posted on 2025-11-052025-11-05 by Rico

This post documents how to import .sql or .sql.gz backup files into MariaDB (version 12.1.1) running inside a Docker container, including common mistakes and their fixes. 1. Background When managing databases in containerized environments, it’s common to deploy MariaDB inside Docker and occasionally import database backups for restoration or migration. Example environment: Item Value Container…

Read more

在 Docker 容器中匯入 MariaDB SQL 檔案 — 實務筆記

Posted on 2025-11-052025-11-05 by Rico

本文記錄如何在 Docker 容器中執行 MariaDB (12.1.1) 的 SQL 匯入作業,並說明常見錯誤與修正方式,方便日後備查。 一、背景說明 在維運環境中,我們常會在 Docker 容器中部署 MariaDB 資料庫,並需要將備份的 .sql 檔或 .sql.gz 壓縮檔匯入。 以本次環境為例: 項目 設定值 容器名稱 blognufacedb MariaDB 版本 12.1.1-MariaDB 帳號 nuface 密碼 abcd123 資料庫名稱 nuface 匯入檔案 nuface_2025-09-16.sql 二、原始執行指令 執行後出現以下訊息: MariaDB 並未執行匯入,而是列出整份使用說明。 三、問題原因 造成問題的主因是: -p 後面多了一個空白MariaDB 會將 ‘abcd123’ 視為「資料庫名稱」而非密碼,導致參數順序錯亂,程式直接輸出說明文件。 四、正確匯入方式 ✅ 方法 1:-p’密碼’(不能有空白) ✅ 方法 2:使用 –password=密碼 ✅ 方法…

Read more

Recent Posts

  • Postfix + Let’s Encrypt + BIND9 + DANE Fully Automated TLSA Update Guide
  • Postfix + Let’s Encrypt + BIND9 + DANE TLSA 指紋自動更新完整教學
  • Deploying DANE in Postfix
  • 如何在 Postfix 中部署 DANE
  • DANE: DNSSEC-Based TLS Protection

Recent Comments

  1. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on High Availability Architecture, Failover, GeoDNS, Monitoring, and Email Abuse Automation (SOAR)
  2. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on MariaDB + PostfixAdmin: The Core of Virtual Domain & Mailbox Management
  3. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on Daily Operations, Monitoring, and Performance Tuning for an Enterprise Mail System
  4. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on Final Chapter: Complete Troubleshooting Guide & Frequently Asked Questions (FAQ)
  5. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on Network Architecture, DNS Configuration, TLS Design, and Postfix/Dovecot SNI Explained

Archives

  • December 2025
  • November 2025
  • October 2025

Categories

  • AI
  • Apache
  • Cybersecurity
  • Database
  • DNS
  • Docker
  • Fail2Ban
  • FileSystem
  • Firewall
  • Linux
  • LLM
  • Mail
  • N8N
  • OpenLdap
  • OPNsense
  • PHP
  • QoS
  • Samba
  • Switch
  • Virtualization
  • VPN
  • WordPress
© 2025 Nuface Blog | Powered by Superbs Personal Blog theme