CodeCraft Chronicles

Stop Dockerizing Your Dev Databases

Sqltool: Local MySQL/MariaDB instance manager for development. No containers, no systemd services - just isolated database instances that run when you need them.

Features

Requirements

Installation

git clone https://github.com/lucianofedericopereira/sqltool.git
cd sqltool
chmod +x sqltool
sudo cp sqltool /usr/local/bin/

Or just run it from anywhere:

./sqltool help

Quick Demo

Run the included demo script to see sqltool in action:

./tryme.sh

This will: 1. Create a test instance called demo 2. Start it 3. Create a sample table with data 4. Make a backup 5. Stop the instance

After the demo, clean up with ./sqltool remove demo.

Usage

# Create a new database instance
sqltool add myproject

# Start it
sqltool start myproject

# Connect
mysql -u myproject -p -S ~/sql/myproject/data/mysql.sock
# or via TCP
mysql -u myproject -p -h 127.0.0.1 -P 3307

# Stop when done
sqltool stop myproject

# See all instances
sqltool list

Commands

Command Description
add <project> Create new database instance
remove <project> Delete instance and all data
start <project> Start instance
stop <project> Stop instance
list List all instances
info <project> Show instance details
port <project> Show port number
logs <project> Show recent error logs
backup <project> Create SQL backup
restore <project> <file.sql> Restore from backup
clone <src> <dst> Clone an instance
status <project> Quick status check
help Show help

Directory Structure

All data is stored in ~/sql/:

~/sql/
├── myproject/
│   ├── data/          # MySQL data files
│   │   └── mysql.sock # Unix socket
│   ├── etc/
│   │   └── my.cnf     # Instance config
│   ├── logs/
│   │   └── error.log  # Error log
│   └── scripts/
│       ├── start      # Start script
│       └── stop       # Stop script
├── anotherproject/
│   └── ...
└── backups/           # SQL backups

Supported Distros

Auto-detection and installation works on:

For other distros, install MariaDB manually first.

Why Perl?

Perl is the right tool for this job:

The Unix tradition

Perl follows the Unix philosophy that shaped GNU/Linux: small, focused tools that do one thing well. Like grep, awk, and sed before it, Perl was designed for text processing and system administration - the same tasks this tool performs.

Classic sysadmin tools have always been scripts: - autoconf, automake - Perl and shell - git-send-email - Perl - debhelper - Perl - Countless system utilities in /usr/bin - Perl, shell, awk

This isn't legacy - it's proven engineering. These tools have managed millions of servers for decades. Perl is part of the GNU/Linux ecosystem in a way that newer languages simply aren't.

Why this matters today

In 2026, installing a simple CLI tool often means: - Python: create venv, pip install dependencies, hope nothing conflicts with system Python - Node: npm install, node_modules bloat, version conflicts - Rust/Go: compile step, or trust pre-built binaries

With Perl:

chmod +x sqltool
./sqltool add myproject

That's it. Works on a fresh Debian install. Works on a minimal Alpine container. Works on your colleague's Fedora laptop. No pyproject.toml, no package.json, no build artifacts.

For a CLI tool that manages system processes and files, Perl hits the sweet spot between shell scripts (too limited for complex logic) and heavier languages (unnecessary complexity for this use case).

Default Credentials

Each instance creates:

Security Note

The default password admin1234 is meant for local development only. These instances bind to 127.0.0.1 by default and are not accessible from the network.

If you need to change the password or create additional users, connect as root:

mysql -u root -S ~/sql/myproject/data/mysql.sock

Then run:

ALTER USER 'myproject'@'localhost' IDENTIFIED BY 'your_secure_password';
FLUSH PRIVILEGES;

Never expose these instances to the network without proper security configuration.

License

LGPL-2.1 - See source file for details.

Comments