自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

MySQL導(dǎo)入導(dǎo)出命令-mysqldump

數(shù)據(jù)庫(kù) MySQL
mysqldump 是個(gè)mysql數(shù)據(jù)庫(kù)自帶的命令行工具,單線程執(zhí)行,可以用來(lái)備份和還原數(shù)據(jù)??梢陨?CSV、TXT、XML格式的文件輸出。

一、mysqldump工具介紹

mysqldump 是個(gè)mysql數(shù)據(jù)庫(kù)自帶的命令行工具,單線程執(zhí)行,可以用來(lái)備份和還原數(shù)據(jù)。可以生成 CSV、TXT、XML格式的文件輸出。

查看幫助文檔

二、利用mysqldump進(jìn)行數(shù)據(jù)庫(kù)備份

1. 數(shù)據(jù)庫(kù)操作

(1) 備份所有數(shù)據(jù)庫(kù)

  1. mysqldump -h 主機(jī)IP -uroot -p --all-database > /data/dball.sql 

(2) 備份多個(gè)數(shù)據(jù)庫(kù)

  1. mysqldump -h 主機(jī)IP -uroot -p db1 db2 db3 >/data/db123.sql 

(3) 備份單數(shù)據(jù)庫(kù)

  1. mysqldump -h 主機(jī)IP -uroot -p db >/data/db.sql 

2. 數(shù)據(jù)庫(kù)中表操作

(1) 備份數(shù)據(jù)庫(kù)中多張表

  1. mysqldump -h 主機(jī)IP -uroot -p db table1  table2 >/data/db_table12.sql 

(2) 備份數(shù)據(jù)庫(kù)中一張表

  1. mysqldump -h 主機(jī)IP -uroot -p db table   >/data/db_table.sql 

(3) 根據(jù)where進(jìn)行備份

  1. mysqldump -h 主機(jī)IP -uroot -p db table  --where " 查詢條件" >/data/db_table.sql 

(4) 備份數(shù)據(jù)中,忽略某張表

  1. mysqldump -h 主機(jī)IP -uroot -p db --ignore-table=logtable --ignore-table=historytable >/data/db_table.sql 

3. 數(shù)據(jù)庫(kù)只導(dǎo)出表結(jié)構(gòu)或數(shù)據(jù),正常情況下導(dǎo)出表結(jié)構(gòu)和數(shù)據(jù)都存在

(1) 只導(dǎo)出表結(jié)構(gòu),不導(dǎo)出數(shù)據(jù)

  1. mysqldump -h主機(jī)IP   -d  -uroot -p  數(shù)據(jù)庫(kù)名 > db.sql 

(2) 只導(dǎo)出數(shù)據(jù),不導(dǎo)出表結(jié)構(gòu)

  1. mysqldump -h主機(jī)IP -t   -uroot -p  數(shù)據(jù)庫(kù)名 > db.sql 

4. 通用備份命令

  1. mysqldump   -h -uroot -p --default-character-set=utf-8  --set-gtid-purged=OFF --lock-tables=false  -R -E  --databases  db | gzip >  /root/db.sql.gz 
  1. --default-character-set=utf-8   指定字符集 
  2. --set-gtid-purged=OFF 重新生產(chǎn)GTID,而不用原來(lái)的 
  3. --lock-tables 不鎖表 
  4. -R   Dump stored routines (functions and procedures) 
  5. -E  Dump events 
  6. gzip 對(duì)備份進(jìn)行壓縮 

三、利用mysqldump進(jìn)行數(shù)據(jù)庫(kù)還原

第一種:

  1. mysqldump -h 主機(jī)IP -uroot -p db < /root/db.sql 

第二種:source 命令

  1. [root@izbp10lvzs7171weegqj8xz ~]# mysql -uroot -p 
  2. mysql: [Warning] Using a password on the command line interface can be insecure. 
  3. Welcome to the MySQL monitor.  Commands end with ; or \g. 
  4. Your MySQL connection id is 62669 
  5. Server version: 5.7.23-log MySQL Community Server (GPL) 
  6.  
  7. Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. 
  8.  
  9. Oracle is a registered trademark of Oracle Corporation and/or its 
  10. affiliates. Other names may be trademarks of their respective 
  11. owners. 
  12.  
  13. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 
  14.  
  15. 21:  root@localhost:[(none)]> use test; 
  16. Database changed 
  17. 21:  root@localhost:[test]> source /root/db.sql 
責(zé)任編輯:趙寧寧 來(lái)源: Linux運(yùn)維技術(shù)之路
相關(guān)推薦

2010-05-28 19:20:36

MySQL mysql

2010-05-26 17:12:52

2011-05-13 09:16:03

Mysqlmysqldump命令

2011-04-08 15:22:56

Oracle導(dǎo)入導(dǎo)出命令

2011-05-16 13:05:56

SQL導(dǎo)入導(dǎo)出MYSQL

2011-05-16 14:17:31

MySQL導(dǎo)入導(dǎo)出大量數(shù)據(jù)

2010-05-24 17:20:07

MySQL導(dǎo)入

2021-11-12 15:42:34

MySQL數(shù)據(jù)庫(kù)權(quán)限

2023-12-31 09:23:00

MySQL數(shù)據(jù)導(dǎo)入數(shù)據(jù)庫(kù)

2011-04-13 10:09:50

Oracle數(shù)據(jù)泵導(dǎo)入導(dǎo)出

2010-06-09 10:09:39

MySQL 數(shù)據(jù)庫(kù)導(dǎo)入

2010-06-02 11:34:23

MySQL 數(shù)據(jù)庫(kù)導(dǎo)入

2011-05-19 14:29:49

DB2導(dǎo)入導(dǎo)出

2021-04-07 10:20:31

MySQL數(shù)據(jù)庫(kù)命令

2011-05-24 09:51:07

MySQLMongoDB

2023-03-28 07:17:25

場(chǎng)景數(shù)據(jù)業(yè)務(wù)

2014-08-15 13:44:40

mongodb

2018-12-12 14:15:40

MongoDB熱備份工具數(shù)據(jù)庫(kù)

2012-02-21 10:10:16

2011-01-18 17:05:35

Thunderbird郵件導(dǎo)入導(dǎo)出
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)