put mysqldump file into a directory

dotKer

Member
Joined
Aug 16, 2019
Messages
69
Reaction score
14
Credits
0
$ mysqldump -u root -p testDB > testDB1.sql
Enter password:
The shell script above works fine.


I like to make it in a directory "myBackup".
So I did the following shell script
$ mysqldump -u root -p testDB > myBackup/testDB1.sql
bash: myBackup/testDB.sql: Permission denied

But it says "Permission denied" like the above.

What is the problems?


How can I put "testDB.sql" into "myBackup" directory?
 


Off the top of my head - the two most likely scenarios are:
1. The directory doesn’t exist.
In which case you will need to create it using mkdir before using mysqldump.

2. The directory exists, but the permissions/ownership of the directory prevents the script from writing to the directory.
In which case, you will need to ensure that the permissions will allow your script to write to it.
 

Members online


Top