PHPackages                             vwedesam/mysql-export-import - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. vwedesam/mysql-export-import

ActiveLibrary[Database &amp; ORM](/categories/database)

vwedesam/mysql-export-import
============================

import and export mysql Database/Table

4221[1 PRs](https://github.com/vwedesam/Mysql-Export-Import/pulls)PHP

Since Jan 26Pushed 2y ago1 watchersCompare

[ Source](https://github.com/vwedesam/Mysql-Export-Import)[ Packagist](https://packagist.org/packages/vwedesam/mysql-export-import)[ RSS](/packages/vwedesam-mysql-export-import/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Export MySQL database and Import it from a dump file in PHP
===========================================================

[](#export-mysql-database-and-import-it-from-a-dump-file-in-php)

\[[![Build Status](https://camo.githubusercontent.com/dacafb09d4bf062fccb3dc244e5aaff769395d31d2cc8c61c9fee17d1b2ecdf6/68747470733a2f2f7472617669732d63692e6f72672f6a6f656d6363616e6e2f64696c6c696e6765722e7376673f6272616e63683d6d6173746572)](https://camo.githubusercontent.com/dacafb09d4bf062fccb3dc244e5aaff769395d31d2cc8c61c9fee17d1b2ecdf6/68747470733a2f2f7472617669732d63692e6f72672f6a6f656d6363616e6e2f64696c6c696e6765722e7376673f6272616e63683d6d6173746572)\]

MySQL is a popular Linux-based database program. As a database, MySQL is a versatile application. It can be used for something as simple as a product database, or as complex as a Wordpress website..

This package will help you Export a MySQL database and Import it from a dump file in PHP.

Features!
=========

[](#features)

- Export MySQL database and Tables to a file (.sql)
- Import it from a file

> See [SQLITE Export And Import LIbraray ](https://github.com/vwedesam/Sqlite-Export-Import) for SQLITE DB EXport and Import

### Installation

[](#installation)

This Library requires [PHP](https://php.net/) to run.

```
$ composer require vwedesam/mysql-export-import
```

### Example:1

[](#example1)

> using helper function **mysqlExporter"** and **MysqlImporter** with connection "params"

```
require "../vendor/autoload.php";

	$host = "localhost";
	$user = "root";
	$pass = "";
	$name = "my_mysql_db";

	// Connection Parameters
	$connection_params = [
						'host' => $host,
						'name' => $name,
						'user' => $user,
						'pass' => $pass
                    ];

        // parameters
        // 1: Mysql database Instance
        // 2. mysql tables to be export
        // 3. backup name
        // 4. connection parameters
        MysqlExporter(null, ['products'], false, $connection_params);

        // parameters
        // 1: Mysql database Instance
        // 2. full path eg "../filepath/db.sql" to mysql dump file (.sql, .zip)
        // 3. connectoin params
        MysqlImporter(null, $sql_content, $connection_params);
        // return: true / false

```

### Example:2

[](#example2)

> using helper function **mysqlExporter** and **MysqlImporter** with "Mysql Instance"

```
require "../vendor/autoload.php";

	$host = "localhost";
	$user = "root";
	$pass = "";
	$name = "my_mysql_db";

	$dsn = "mysql:dbname=$name;host=$host";

        // PDO instance
        $db_instance = new \PDO($dsn, $user, $pass);

        MysqlExporter($db_instance);

        MysqlImporter($db_instance, $sql_content);
        // return: true / false

```

### More Examples

[](#more-examples)

[Mysql Export Import with classes, functions and connection params](https://github.com/vwedesam/Mysql-Export-Import/blob/main/examples)

License
-------

[](#license)

MIT

###  Health Score

19

—

LowBetter than 9% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity31

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/53244114?v=4)[Eshemiedomi Samuel Oghenevwede](/maintainers/vwedesam)[@vwedesam](https://github.com/vwedesam)

---

Top Contributors

[![vwedesam](https://avatars.githubusercontent.com/u/53244114?v=4)](https://github.com/vwedesam "vwedesam (6 commits)")

---

Tags

database-backupexportimport-and-exportimport-exportmysqlmysql-backupphpmysql

### Embed Badge

![Health badge](/badges/vwedesam-mysql-export-import/health.svg)

```
[![Health](https://phpackages.com/badges/vwedesam-mysql-export-import/health.svg)](https://phpackages.com/packages/vwedesam-mysql-export-import)
```

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k117.2M118](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[jfelder/oracledb

Oracle DB driver for Laravel

11518.4k](/packages/jfelder-oracledb)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
