Export each tables from a database into a separate files using mysqldump command

How to export each table from a database into separate files using the mysqldump command. Create a script file with the following code snippet.

#!/bin/bash 
  T_PATH=Downloads/tables_templates
  for TB in `mysql -u root -proot -N -B -e 'show tables from drupal'`;
  do
  echo "Backing up $TB"
  mysqldump --add-drop-table --add-locks --complete-insert -u root -proot drupal $TB > $T_PATH/template_$TB.sql
  

Where T_PATH is the location of the file where the script will export the tables, and TB is a reference to the current value of the show tables command.

0/5