Backup linux mysql data by table name
The following is about backing up linux mysql data by table name. The secret of the text is that it is close to the topic. So, no gossip, let's go straight to the following, I believe that after reading the backup linux mysql data according to the table name of this article will certainly benefit you.
#! / bin/bash
# user
# Database users
Dbuser= "root"
# Database password
Dbpassword= "chenyong"
# time
Date=$ (date +% Y%m%d)
# Database name
Dbname=sungrowv3
# Road strength of backup data preservation
Url=/home/test/sql/
# specify all tables of the database
Tables=$ (mysql-u$dbuser-p$dbpassword-ss-e "use $dbname;show tables;")
If [!-d $url]; then
Mkdir-p $url
Fi
Cd $url
For t in $tables
Do
Mysqldump-u$dbuser-p$dbpassword $dbname $t > $t.sql
Done
Mysqldump-u$dbuser-p$dbpassword $dbname > $dbname.sql
Zip-m / home/test/$dbname'_'$date.zip. / *
Cd.. /
Rm-rf sql
For the above backup linux mysql data by table name-related content, is there anything you don't understand? Or if you want to know more about it, you can continue to follow our industry information section.