MyDB is a powerful database management tool that provides Git-like branching functionality for MySQL databases. It allows developers to create isolated database environments, manage migrations, and merge changes between branches.
📚 Related Documentation:
- 🌳 Git-like branching for databases
- 📊 Table creation and management
- 🔄 Database migrations with up/down support
- 🔀 Branch merging capabilities
- 📱 GUI interface via MyDB Studio
- 🔒 Automated schema tracking
- 📝 Detailed migration history
- Python 3.7+
- MySQL Server 5.7+ or 8.0+
- pip (Python package manager)
- Clone the repository:
git clone https://github.com/yourusername/mydb-cli.git
cd mydb-cli- Create and activate a virtual environment (recommended):
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install the package in development mode:
pip install -e .Note: requirements.txt is a frozen list of dependencies generated from setup.py and can be used for specific deployment scenarios if needed, but direct installation via setup.py (using pip install -e .) is the primary method for setting up the development environment.
- Initialize your database configuration:
mydb-cli statusThis will create a default configuration file at .mydb/config.json.
- Update the configuration file with your MySQL credentials:
{
"connection": {
"user": "your_username",
"password": "your_password",
"host": "localhost",
"port": 3306,
"database": "your_database",
"auth_plugin": "mysql_native_password"
}
}Create a new branch:
mydb-cli create-branch --branch devList all branches:
mydb-cli list-branchesSwitch to a different branch:
mydb-cli switch-branch --branch devDelete a branch:
mydb-cli delete-branch --branch old_featureMerge branches:
mydb-cli merge-branch --source feature --target mainCreate a new table:
mydb-cli create-table --name users
# Follow the interactive prompts to define columnsList all tables:
mydb-cli list-tablesDescribe table structure:
mydb-cli describe-table --name usersDrop a table:
mydb-cli drop-table --name old_tableCreate a new migration:
mydb-cli create-migration --name add_users_table --description "Create users table with basic fields"Apply migrations:
mydb-cli migrate-up # Apply next pending migration
mydb-cli apply-migration --number 1 # Apply specific migrationRollback migrations:
mydb-cli migrate-down # Rollback last applied migrationCheck migration status:
mydb-cli migration-statusLaunch the MyDB Studio interface:
mydb-cli studio.
├── LICENSE
├── README.md
├── assets
│ ├── index-BKO7flFT.css
│ └── index-D0-aluUL.js
├── image-1.png
├── image.png
├── index.html
├── main.py
├── migrations/
├── requirements.txt
├── streamlit.png
├── studio.py
├── testsqlcode01.txt
├── testsqlcode02.txt
└── vite.svg
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the BSD 3-Clause License - see the LICENSE file for details. This would allow me to make some features of this tool to be served on a proprietory basis as well where i'll earn by providing subscriptions for my dev tool features.
If you encounter any issues or have questions, please open an issue on GitHub.


