• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

How to MySQL Database daily backup via Scheduled Tasks?

Adam12345

New Pleskian
Hello,

I'm new to Parallels Panel. I use version 11.0.9. I searched the forum and tutorials for a while but I couldn't find the exact solution. I want to backup mysql database daily. First of all, what is the best way for daily database backup in plesk. I'm trying to do this in Scheduled Tasks and I use mysqldump command although I'm not sure. Can you please tell me my mistakes?

I chose the time and day first and then I switched on the task. I typed the following command to
Command line.

mysqldump -uusername -ppassword databasename | gzip -9 >/httpdocs/mydatabase.sql.gz
or
mysqldump -uusername -ppassword databasename >/httpdocs/mydatabase.sql.gz

This created only a blank file. When I use this without gzip, nothing changes.

1- Is mysqldump right command for database backup?
2- Should I define full path for mysqldump, gzip and database? If so, how can I find out the full path of mysqldump, gzip and my database? Because I can't see their locations in panel.
3- I can't see any error message. There is not any log file in httpdocs folder. Where does the log file exist?
4- It is weird but should the username be "database user" or should I write "root" ?

Thank you.
 
You should use following command

/usr/bin/mysqldump -uadmin -p`cat /etc/psa/.psa.shadow` databasename | gzip -9 > /path/databasename.sql.gz
 
Hi Igor, thanks for your reply. I tried the following commands but they didn't work. They only created blank backup files 0 kb sized.

/usr/bin/mysqldump -uadmin -p`cat /etc/psa/.psa.shadow` mydatabasename | gzip -9 > /httpdocs/mydatabasename.sql.gz

/usr/bin/mysqldump -uroot -p`cat /etc/psa/.psa.shadow` mydatabasename | gzip -9 > /httpdocs/mydatabasename.sql.gz

/usr/bin/mysqldump -udatabaseusername -p`cat /etc/psa/.psa.shadow` mydatabasename | gzip -9 > /httpdocs/mydatabasename.sql.gz

I think the directory structure is different. Is that true? There is no bin folder under usr. The bin folder exists in the root and there are only the following files under bin folder :

bash 792 KB
cat 32.0 KB
cp 80.0 KB
du 76.0 KB
false 24.0 KB
grep 96.0 KB
groups 8.00 KB
head 36.0 KB
id 32.0 KB
less 152 KB
ln 36.0 KB
ls 100 KB
mkdir 36.0 KB
more 40.0 KB
mv 88.0 KB
pwd 32.0 KB
rm 52.0 KB
rmdir 28.0 KB
scp 64.0 KB
sh 792 KB
tail 48.0 KB
touch 48.0 KB
true 24.0 KB
vi

And there is no cat /etc/psa/.psa.shadow folders and files. There is a folder named etc in the root directory and there is a file named passwd in it.

How can I access all file and directory structure including hiddens?
How can I learn the full path of mysql database?
 
Back
Top