A command-line tool to export MySQL database schema into SQL files.
Basic usage:
schemaloader load -h hostname -P port -u username -p password -db database_name -out /path/to/schema.sql
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 |
schemaloader load -h localhost -P 3306 -u root -p mypassword -db myapp -out dump/schema.sql
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;
This project is licensed under the MIT License - see the LICENSE file for details.
- Kenta Takahashi (@knwoop)