- Backup Mysql Database and Send mail through Python email.
- Backup should run every day at 12 clocks by cron jobs.
- Environment used is centos7.
- Python-3.7.4
- MYSQL 5.7
sh python37-install.sh
sh mysql57_install.sh
Edit send_mail.py for Email information.
- In email['from'] - Write sender's name
- In email['to'] - Receiver email
- In smtp.login - Add sender's mail and password
Edit mysql_dump.sh
- DBUSER
- DBPASSWORD
- DBNAME
- FILELOCATION - Added the file location to create dumpfiles.
- Enable less secure apps Permission in gmail - https://myaccount.google.com/lesssecureapps
- Still problem in sending mail, then try clearing Captcha - https://accounts.google.com/DisplayUnlockCaptcha
crontab -e
0 12 * * * sh /home/centos/mysqldump-to-mail-using-python-email/mysql_dump.sh
sh mysql_dump