简体   繁体   English

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

[英]How to dump mysql database into specific folder in linux using bash script ?

I want to dump my database tables into a specific folder repeatedly in a file specified by real time date and time of dumping. 我想将数据库表重复转储到实时转储日期和时间指定的文件中的特定文件夹中。 How can I do ? 我能怎么做 ?

  1. Write this script inside any file for eg 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. 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM