https://github.com/dg/MySQL-dump
MySQL Dump Utility
https://github.com/dg/MySQL-dump
backup mysql-dump-utility php
Last synced: 3 months ago
JSON representation
MySQL Dump Utility
- Host: GitHub
- URL: https://github.com/dg/MySQL-dump
- Owner: dg
- License: bsd-3-clause
- Created: 2010-06-05T14:38:50.000Z (about 15 years ago)
- Default Branch: master
- Last Pushed: 2021-04-14T08:13:52.000Z (about 4 years ago)
- Last Synced: 2024-05-18T05:41:12.430Z (about 1 year ago)
- Topics: backup, mysql-dump-utility, php
- Language: PHP
- Homepage: https://nette.org
- Size: 23.4 KB
- Stars: 200
- Watchers: 17
- Forks: 50
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
- Funding: .github/funding.yml
- License: license.md
Awesome Lists containing this project
README
MySQL Dump Utility
==================This is a backup utility used to dump a database for backup or transfer to another MySQL server.
The dump typically contains SQL statements to create the table, populate it, or both.It requires PHP 5.6 (release 1.5) or PHP 7.1 or later.
Usage
-----Create [MySQLi](http://www.php.net/manual/en/mysqli.construct.php) object and pass it to the MySQLDump:
```php
$db = new mysqli('localhost', 'root', 'password', 'database');
$dump = new MySQLDump($db);
```You can optionally specify how each table or view should be exported:
```php
$dump->tables['search_cache'] = MySQLDump::DROP | MySQLDump::CREATE;
$dump->tables['log'] = MySQLDump::NONE;
```Then simply call `save()` or `write()`:
```php
$dump->save('export.sql.gz');
```Import dump from file to database this way:
```php
$import = new MySQLImport($db);
$import->load('dump.sql.gz');
```If you like it, **[please make a donation now](https://nette.org/make-donation?to=mysql-dump)**. Thank you!