PHPackages                             davcs86/php-mysqlimporter - 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. davcs86/php-mysqlimporter

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

davcs86/php-mysqlimporter
=========================

PHP class for importing big SQL files into MySQL.

54.4k4[1 issues](https://github.com/davcs86/php-mysqlimporter/issues)PHP

Since Sep 2Pushed 11y agoCompare

[ Source](https://github.com/davcs86/php-mysqlimporter)[ Packagist](https://packagist.org/packages/davcs86/php-mysqlimporter)[ RSS](/packages/davcs86-php-mysqlimporter/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

PHP Mysql Importer
==================

[](#php-mysql-importer)

PHP class for importing big SQL files into MySQL server.

This class comes to overpass the problem in phpMyAdmin (and others) , when you can't upload files of decent size through the browser upload.

With this class you get the same function, just by uploading the file via FTP and doing the importing with 3 simple commands, e.g.

```
include("php-mysqlimporter.php");
$mysqlImport = new MySQLImporter("localhost", "user", "password");
$mysqlImport->doImport("yourfile.sql");
```

Links
-----

[](#links)

- Homepage:
- Source:
- Bugs:

Requirements:
-------------

[](#requirements)

1. PHP 5.0+
2. MySQLi extension

Download
--------

[](#download)

- As zip from this repository:
- With git from a terminal:

```
git clone https://github.com/davcs86/php-mysqlimporter.git

```

- Using Composer, add "davcs86/php-mysqimporter" as a dependency in your project's *composer.json* file:

```
{
    "require": {
		"davcs86/php-mysqlimporter": "dev-master"
    }
}

```

How to Use:
-----------

[](#how-to-use)

### Initialization

[](#initialization)

```
$mysqlImport = new MySQLImporter($host, $user, $password, $port);
```

ParameterDescription$hostHost (or IP) of the MySQL server.$userUsername to login into the server.$passwordPassword of the user.$portListen port of the MySQL server.
*Optional*. It uses the value in *mysqli.default\_port* as default.### Basic Importing

[](#basic-importing)

```
$mysqlImport->doImport("./sqlfiles/test1.sql");
```

### Error Reporting

[](#error-reporting)

```
if ($mysqlImport->hadErrors){
	// Display errors
	echo "\n";
	print_r($mysqlImport->errors);
	echo "\n";
} else {
	echo "File imported successfully";
}
```

### Advanced Importing

[](#advanced-importing)

1. You can specify database.
    **NOTE:** This doesn't override the clause *USE* in the file, but sets an initial database.

```
$mysqlImport->doImport("./sqlfiles/test1.sql", "initial_db_name");
```

2. You can create the database (if it doesn't exist).

```
$mysqlImport->doImport("./sqlfiles/test1.sql", "initial_db_name", true);
```

3. You can drop the database and then create it.

```
$mysqlImport->doImport("./sqlfiles/test1.sql", "initial_db_name", true, true);
```

4. Or just drop it. Particularly useful if you already got a CREATE statement in your SQL file.

```
$mysqlImport->doImport("./sqlfiles/test1.sql", "initial_db_name", false, true);
```

Support
-------

[](#support)

Drop me line on:  or to:

Donations
---------

[](#donations)

Did this project help you to save (or earn) some money?
Please, support to the author by making a small donation.

[![Buy Me A Coffee :) @ PayPal](https://camo.githubusercontent.com/821fcab69bbe18c835a51c787d027818207ad06627d924d0e9ab5f70e7df0970/687474703a2f2f6b6f2d66692e636f6d2f696d672f627574746f6e2d342e706e67)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2PK29ZFPUZ5WL)

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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://www.gravatar.com/avatar/bec36c687be9959277929ea368b80922783d4ddcf09f9b9fbbd4d5475fbab257?d=identicon)[davcs86](/maintainers/davcs86)

---

Top Contributors

[![davcs86](https://avatars.githubusercontent.com/u/1994615?v=4)](https://github.com/davcs86 "davcs86 (26 commits)")

### Embed Badge

![Health badge](/badges/davcs86-php-mysqlimporter/health.svg)

```
[![Health](https://phpackages.com/badges/davcs86-php-mysqlimporter/health.svg)](https://phpackages.com/packages/davcs86-php-mysqlimporter)
```

###  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)
