111

If my database has 10 tables and I want to dump only 3 tables. Is it possible with mysqldump command?

codeforester
  • 34,080
  • 14
  • 96
  • 122
Harish Kurup
  • 6,969
  • 18
  • 63
  • 93
  • Possible duplicate of [How to take backup of a single table in a MySQL database?](https://stackoverflow.com/questions/6682916/how-to-take-backup-of-a-single-table-in-a-mysql-database) – codeforester Oct 26 '18 at 23:56

2 Answers2

218
Usage: mysqldump [OPTIONS] database [tables]

i.e.

mysqldump -u username -p db_name table1_name table2_name table3_name > dump.sql
Lauri Lehtinen
  • 10,307
  • 2
  • 29
  • 29
11

If you're in local machine then use this command

/usr/local/mysql/bin/mysqldump -h127.0.0.1 --port = 3306 -u [username] -p [password] --databases [db_name] --tables [tablename] > /to/path/tablename.sql;

For remote machine, use below one

/usr/local/mysql/bin/mysqldump -h [remoteip] --port = 3306 -u [username] -p [password] --databases [db_name] --tables [tablename] > /to/path/tablename.sql;
Geeky Ninja
  • 5,922
  • 8
  • 37
  • 52
Raja Bose
  • 304
  • 2
  • 8