Skip to content

Latest commit

 

History

History
60 lines (41 loc) · 1.24 KB

README.md

File metadata and controls

60 lines (41 loc) · 1.24 KB

schemaloader

A command-line tool to export MySQL database schema into SQL files.

Usage

Basic usage:

schemaloader load -h hostname -P port -u username -p password -db database_name -out /path/to/schema.sql

Command Line Options

Option Description Default
-h MySQL host localhost
-P MySQL port 3306
-u MySQL username (required)
-p MySQL password (required)
-db Database name (required)
-out Output file path schema.sql
-print Output as standard output false

Example

schemaloader load -h localhost -P 3306 -u root -p mypassword -db myapp -out dump/schema.sql

Output Format

The generated schema.sql file includes:

-- Generated by schemaloader on 2024-11-10 15:04:05
-- Database: myapp
-- Host: localhost:3306

SET FOREIGN_KEY_CHECKS=0;

-- Table definitions
DROP TABLE IF EXISTS `table_name`;
CREATE TABLE `table_name` (
  -- column definitions
  -- indexes
  -- foreign keys
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

SET FOREIGN_KEY_CHECKS=1;

License

This project is licensed under the MIT License - see the LICENSE file for details.

Authors

  • Kenta Takahashi (@knwoop)