Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Backup linux mysql data by table name

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report