Git Product home page Git Product logo

php-mysql-export-import's Introduction

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

[Build Status]

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!

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

See SQLITE Export And Import LIbraray for SQLITE DB EXport and Import

Installation

This Library requires PHP to run.

$ composer require vwedesam/mysql-export-import

Example:1

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 <instance>
        // 2. mysql tables to be export <Array>
        // 3. backup name <String>
        // 4. connection parameters <Array>
        MysqlExporter(null, ['products'], false, $connection_params);


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

Example:2

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

Mysql Export Import with classes, functions and connection params

License

MIT

php-mysql-export-import's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

dsyafaatul

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.