提交
This commit is contained in:
parent
51a4707a5f
commit
ecd0dc9969
47
source/_posts/MySQL.md
Normal file
47
source/_posts/MySQL.md
Normal file
@ -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
|
||||
```
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user