I want to take
backup of my
mysql data using
mysqldump. I have three files containing names of mysql
tables line by line. My script has this line -
mysqldump -h localhost -uroot --lock-tables=false db < $2 > ~/backup/$name'.sql'
I am using
getopts to handle some
options. So basically
$2 is the file I am going to provide. This file has - table1 and table2. So this command should only take backup of these two tables.
But when I
~/backup/name.sql file it shows all the backup of
db. I am not sure if it is the combined backup of all the tables from all the 3 files or the whole db.
But it is taking backup of whole db instead of two tables.
What am I doing wrong?
It works fine when I put it like this -
mysqldump -h localhost -uroot --lock-tables=false db table1 table2 > ~/backup/$name'.sql'