mysql dumping and restoring


Author: yifei / Created: July 6, 2017, 7:36 p.m. / Modified: July 6, 2017, 7:36 p.m. / Edit

basic usage

the help message is pretty easy to read

Usage: mysqldump [OPTIONS] database [tables]
OR     mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
OR     mysqldump [OPTIONS] --all-databases [OPTIONS]
  1. dump

mysqldump -u root -p DB_NAME [TABLE_NAME] > backup.sql

可以选择只 dump 一个数据库或者一个表

  1. load

mysql -u root -p DB_NAME < backup.sql


评论区