Hi guys,
We can ignore database tables while taking mysqldump using the below command
mysqldump -u username -p database –ignore-table=database.table1 –ignore-table=database.table2 > database.sql
However if we want to ignore more tables we need to add the tables manually and its a real pain in the A$$
Here I am showing how to take the mysqldump using regex to ignore mysql tables.
For example:- If I want to ignore the below tables starting from
-
alice_token,
-
import_
3)sales_order_item_shipment_tracking
4)sales_order_item_status_history
5)stock_import
6)ums
root@vishnu-machine# cd /var/lib/mysql/
root@vishnu-machine:/var/lib/mysql/
root@vishnu-machine:/var/lib/mysql/
And verify the file “mydump.cnf”
root@vishnu-machine:/var/lib/mysql/
ignore-table=
ignore-table=
ignore-table=
ignore-table=
ignore-table=
ignore-table=
ignore-table=
You can see the above entries in the file “mydump.cnf”
root@vishnu-machine:/var/lib/mysql/
And here it is new dump without tables as mentioned above.