如何使用bash脚本将mysql数据库转储到linux中的特定文件夹中?

70gysomp  于 2021-06-19  发布在  Mysql
关注(0)|答案(1)|浏览(364)

我想将我的数据库表转储到由实时转储日期和时间指定的文件中的特定文件夹中。我该怎么办?

kulphzqa

kulphzqa1#

1. Write this script inside any file for e.g. Sky [file extension doesn't matter] and make this file as executable file

current_date_time="`date "+%Y-%m-%d%H:%M:%S"`";
cd /home/akashgudadhe/FunZone/
mysqldump -u [user_name] -p[password] [dbname] > `pwd`/"$current_date_time.sql"

2. Run using terminal

./Sky [<----any_of your file name that you preferred above]

It will save [newly_created_file] into specified directory automatically.

相关问题