From ecd0dc99695a3d20f3bde1e4ab7f5d564f95497c Mon Sep 17 00:00:00 2001 From: "YUN-PC5\\user" Date: Tue, 14 Mar 2023 17:00:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/_posts/MySQL.md | 47 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 source/_posts/MySQL.md diff --git a/source/_posts/MySQL.md b/source/_posts/MySQL.md new file mode 100644 index 0000000..59de64c --- /dev/null +++ b/source/_posts/MySQL.md @@ -0,0 +1,47 @@ +# MySQL + +## mysqldump备份数据库 + +### 备份实例下的所有库 + +```shell +mysqldump -uroot -p -A > all.sql +``` + +### 备份单个指定数据库 + +```shell +mysqldump -uroot -p test > test.sql +``` + +### 备份多个指定数据库 + +```shell +mysqldump -uroot -p test1 test2 > test12.sql +``` + +### 备份指定数据库中的单个表 + +```shell +mysqldump -uroot -p test user > test.user.sql +``` + +### 备份指定数据库中的多个表 + +```shell +mysqldump -uroot -p test user role > test.ur.sql +``` + +### 备份数据库表结构只包含DDL语句 + +```shell +# --no-data 或 -d +mysqldump -uroot -p test --no-data > test.sql +``` + +### 备份数据库带库名 + +```shell +mysqldump -uroot -p -B test > test.sql +``` +