├── docs # Contains documents
├── research # Contains pre-research.
├── source # Contains project source code.
│ ├── main.php # Main app file.
└── README.MD # Readme Content.
└── LICENSE.MD # LICENSE of the project.
This repository contains a PHP script designed for automating MySQL database backups from a hosting server to Google Drive. The script utilizes cron jobs to schedule regular backups, ensuring data integrity and availability. Backups are securely transferred to Google Drive for safekeeping and can be configured to delete older backups to manage storage efficiently.
- Automated Backup: Schedule backups at regular intervals using cron jobs.
- Secure Transfer: Safely transfer backups to Google Drive using OAuth for authentication.
- Storage Management: Option to delete older backups to optimize storage usage.
- Customizable: Easily configure backup settings and schedule as per your requirements. Usage:
- PHP
- Python
- google-apiclient:^2.0
-
Step 01: Enable Google Drive API
- Go to the Google Cloud Console.
- Create a new project or select an existing project.
- Enable the Google Drive API.
-
Step 02: Create a service account
- Navigate to IAM & Admin > Service accounts.
- Fill in the Service Account Details.
- Create and Download a JSON Key File.
- Use the Service Account using JSON Key.
-
Step 03: Create and save JSON Auth Key
- Navigate to Service accounts > Keys.
- Select JSON Key and save it (This key is used for authentication purpose).
-
Step 04: Create a folder in Google Drive and share it to service account mail
-
Step 05: Deploy the script to the server
-
Step 06: Install google-apiclient:^2.0 using composer through SSH
composer require google/apiclient:^2.0
-
Step 07: Update Folder ID & Auth Key JSON file path in the main.php script
-
Step 08: Update credentials in the main.php script
-
Step 09: Hook up this script with cron schedular in the Server