偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

MySQL導入導出命令-mysqldump

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

一、mysqldump工具介紹

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

查看幫助文檔

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

1. 數(shù)據庫操作

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

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

(2) 備份多個數(shù)據庫

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

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

  1. mysqldump -h 主機IP -uroot -p db >/data/db.sql 

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

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

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

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

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

(3) 根據where進行備份

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

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

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

3. 數(shù)據庫只導出表結構或數(shù)據,正常情況下導出表結構和數(shù)據都存在

(1) 只導出表結構,不導出數(shù)據

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

(2) 只導出數(shù)據,不導出表結構

  1. mysqldump -h主機IP -t   -uroot -p  數(shù)據庫名 > 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 重新生產GTID,而不用原來的 
  3. --lock-tables 不鎖表 
  4. -R   Dump stored routines (functions and procedures) 
  5. -E  Dump events 
  6. gzip 對備份進行壓縮 

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

第一種:

  1. mysqldump -h 主機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 
責任編輯:趙寧寧 來源: Linux運維技術之路
相關推薦

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導入導出命令

2010-05-24 17:20:07

MySQL導入

2011-05-16 14:17:31

MySQL導入導出大量數(shù)據

2023-12-31 09:23:00

MySQL數(shù)據導入數(shù)據庫

2011-05-16 13:05:56

SQL導入導出MYSQL

2011-04-13 10:09:50

Oracle數(shù)據泵導入導出

2021-11-12 15:42:34

MySQL數(shù)據庫權限

2010-06-02 11:34:23

MySQL 數(shù)據庫導入

2011-05-19 14:29:49

DB2導入導出

2021-04-07 10:20:31

MySQL數(shù)據庫命令

2010-06-09 10:09:39

MySQL 數(shù)據庫導入

2014-08-15 13:44:40

mongodb

2018-12-12 14:15:40

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

2023-03-28 07:17:25

場景數(shù)據業(yè)務

2011-05-24 09:51:07

MySQLMongoDB

2012-02-21 10:10:16

2010-04-22 10:16:43

點贊
收藏

51CTO技術棧公眾號