Backup MySQL Database avatar

Backup MySQL Database

Try for free

Pay $1.00 for 1,000 Backups

Go to Store
Backup MySQL Database

Backup MySQL Database

worldunboxer/backup-mysql-database
Try for free

Pay $1.00 for 1,000 Backups

This actor connects to a MySQL database, and generates a complete database backup. The output is saved SQL format and is uploaded to the Apify key-value store for easy access. Simply provide the database connection details to get started.

This Apify actor connects to a MySQL database and performs a full database backup. It supports sql output format. The backup includes all the tables and their data from the specified database.

Overview

This actor:

  1. Connects to a MySQL database using credentials provided in the input.
  2. Backup the data from all tables in the database.
  3. Supports dumping data in SQL format.
  4. Saves the backup to a file.
  5. Uploads the backup to the Apify key-value store for easy access.
  6. Send backup to user specified email.

Input Parameters

This actor requires the following input parameters to be provided:

  • host: The host of the MySQL database.
  • user: The username to connect to the database.
  • password: The password for the MySQL user.
  • database: The name of the database to backup.
  • email(optional): Backup will be sent to this email also.

Example:

1{
2  "host": "xryf.en.domain.com",
3  "user": "test_user",
4  "password": "your_database_password",
5  "database": "my_database",
6  "email": "test@gmail.com"
7}

Functionality

1. Connecting to the Database

The actor connects to the MySQL database using the provided credentials and checks if the necessary parameters are available.

2. Querying Tables

The actor queries the SHOW TABLES command to fetch all table names in the database.

3. Backup Table Data

Actor backup all the tables with all entries in it.

4. Output Format

The actor supports output format:

  • SQL: The backup is generated as an SQL file containing INSERT statements for each table.

5. Saving the Backup

The backup is saved to a local file named backup.sql.

6. Uploading to Apify Key-Value Store

The actor uploads the backup file to the Apify key-value store for easy access, which can be used in subsequent tasks or workflows.

7. Closing the Connection

Once the database backup is completed, the actor gracefully closes the MySQL connection and exits.

Usage

To run this actor on Apify, follow these steps:

  1. Set up your Apify actor.
  2. Provide the required input parameters (MySQL connection details).
  3. Run the actor to get the database backup.

After running the actor, you will receive a database backup file in the specified format, both saved locally and uploaded to the Apify key-value store.

Example Workflow

  1. Create an Apify Actor: Go to the Apify platform and create a new actor.

  2. Set Input Parameters: Provide the MySQL connection details in the input JSON. For example:

{ "host": "xryf.en.domain.com", "user": "test_user", "password": "your_database_password", "database": "my_database", "email": "test@gmail.com" }

13. **Run the Actor**:
2Execute the actor, and it will connect to your MySQL database, backup all tables in the specified format, and save the result to the Apify key-value store.
3
44. **Access the Backup**:
5After the actor finishes, the backup will be available in the Apify key-value store under the key `MYSQL_BACKUP`. You can download it or use it in other workflows.
6
7
8## Contact
9
10For support or inquiries, contact the actor developer at `worldunboxer1@gmail.com` .
11
12## ⚠️ Warning
13
14**This actor does not guarantee successful or accurate backup of your database.**  
15There may be errors during the backup process due to factors such as:
16- Database connection issues.
17- Unsupported data types or special characters.
18- Insufficient permissions for the specified user.
19
20**The developer is not responsible for any inaccuracies, incomplete data, or loss of data resulting from the use of this actor.**  
21It is strongly recommended to verify the backup files and ensure proper configurations and permissions before running this actor.
Developer
Maintained by Community

Actor Metrics

  • 1 monthly user

  • 1 star

  • >99% runs succeeded

  • Created in Jan 2025

  • Modified 38 minutes ago