/dump-mysql-yaml

Script to generate YAML (http://www.yaml.org/) from a MySQL database.

Primary LanguagePHP

dump-mysql-yaml

Introduction

Script to generate YAML (http://www.yaml.org/) from a MySQL database. Will generate YAML for either all tables in the specified database, only the specified tables in the specified database or only the given SQL query.

Options

  • -h MySQL database host
  • -u MySQL username
  • -d Name of the MySQL database to dump
  • -t <table(s)> Comma delimited list of tables to dump from database
  • -p MySQL password
  • -f File to dump to
  • -q "" SQL query to dump
  • -qn Name of the "table" when using the -q option
  • -n Convert table names to class names

Usage

    main.php [options] -d <database>
    main.php [options] -d <database> -t table1,table2
    main.php [options] -d <database> -q \"SELECT * FROM `mytable`\" -qn custom_name

Example

    main.php -h localhost -u root -p pass -d test -f dump.yaml