数据库的转储和恢复
使用 mysqldump 转储数据库
mysqldump --set-gtid-purged=OFF -u root -phappy com> d:/doc/it/db.txt
D:\j\msql\bin>mysqldump --set-gtid-purged=OFF -u root -phappy com> d:/doc/it/db.txt
mysqldump: [Warning] Using a password on the command line interface can be insecure.
D:\j\msql\bin>
打开文件 db.txt 可以看到:
-- MySQL dump 10.13 Distrib 9.6.0, for Win64 (x86_64)
--
-- Host: localhost Database: com
-- ------------------------------------------------------
-- Server version 9.6.0
中间内容省略
-- Dump completed on 2026-05-30 21:24:06
恢复转储文件
mysql -u root -phappy db < d:/doc/it/db.txt
D:\j\msql\bin>mysql -u root -phappy db < d:/doc/it/db.txt
mysql: [Warning] Using a password on the command line interface can be insecure.
D:\j\msql\bin>