0

I would like to write a bash script containing next command:

mysqldump -u root -p moodle > moodle_sql_backup_21_08_2018.sql

I added #!/bin/bash but then I get stuck with two problems:

-p parameter doesn't take password thus I have to write password every time. Is there a way to save password into command?

automating date change in name of sql file, is it possible? Something like

moodle_sql_backup_$date("Y-m-d").sql 

from PHP world?

marked as duplicate by muru bash Oct 1 '18 at 8:07

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.