115

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

codeforester
  • 39,467
  • 16
  • 112
  • 140
Harish Kurup
  • 7,257
  • 19
  • 65
  • 94
  • 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

240
Usage: mysqldump [OPTIONS] database [tables]

i.e.

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

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
  • 6,002
  • 8
  • 41
  • 54
Raja Bose
  • 344
  • 2
  • 8