MySQL to TOML Converter

Transform MySQL database dumps into TOML (Tom's Obvious, Minimal Language) configuration format for modern applications

MySQL Input

TOML Output

About MySQL to TOML Converter

Convert MySQL database dumps (CREATE TABLE and INSERT statements) to TOML (Tom's Obvious, Minimal Language) configuration format. TOML is a minimal configuration file format that's easy to read and write, widely used in modern applications like Rust's Cargo, Python's Poetry, and many others.

Key Features

  • Array of Tables: Standard TOML format with [[table]] syntax
  • Inline Tables: Compact format with inline table syntax
  • Type Detection: Automatic detection of strings, numbers, and booleans
  • Key Sanitization: Ensures valid TOML key names
  • Metadata Comments: Optional comments with conversion details
  • Special Character Escaping: Proper escaping for strings
  • File Download: Save as .toml file

How to Use

  1. Input MySQL Data: Paste your MySQL CREATE TABLE and INSERT statements or upload a .sql file
  2. Choose Format: Select array of tables or inline tables format
  3. Configure Options: Toggle metadata comments
  4. Copy or Download: Use the Copy or Download button to save your TOML file

Output Formats

Array of Tables:

  • Uses [[table]] syntax for each record
  • More readable for large datasets
  • Standard TOML format
  • Easy to edit manually

Inline Tables:

  • Uses compact inline syntax
  • Better for small datasets
  • More concise output
  • Array of inline tables

Example Conversion

MySQL Input:

CREATE TABLE config (
  id INT,
  key VARCHAR(100),
  value VARCHAR(255),
  enabled BOOLEAN
);

INSERT INTO config VALUES (1, 'app_name', 'MyApp', true);
INSERT INTO config VALUES (2, 'max_connections', '100', true);

TOML Output (Array of Tables):

[[config]]
id = 1
key = "app_name"
value = "MyApp"
enabled = true

[[config]]
id = 2
key = "max_connections"
value = "100"
enabled = true

TOML Output (Inline Tables):

config = [
  { id = 1, key = "app_name", value = "MyApp", enabled = true },
  { id = 2, key = "max_connections", value = "100", enabled = true }
]

Common Use Cases

  • Configuration Files: Convert database settings to TOML config files
  • Rust Projects: Use with Cargo.toml and other Rust configurations
  • Python Projects: Use with Poetry (pyproject.toml) and other tools
  • Application Settings: Store application configuration data
  • Infrastructure as Code: Define infrastructure settings
  • CI/CD Pipelines: Configure build and deployment settings

TOML Data Types

The converter automatically detects and converts to appropriate TOML types:

  • Strings: Text values enclosed in double quotes
  • Integers: Whole numbers without quotes
  • Floats: Decimal numbers without quotes
  • Booleans: true or false (lowercase)
  • Empty/NULL: Converted to empty strings

Key Sanitization

The converter ensures all keys are valid TOML identifiers:

  • Replaces invalid characters with underscores
  • Ensures keys don't start with numbers
  • Maintains readability while ensuring validity
  • Preserves original meaning where possible

String Escaping

Special characters in strings are properly escaped:

  • Backslash: \\ → \\\\
  • Double Quote: " → \\"
  • Newline: \\n escape sequence
  • Tab: \\t escape sequence
  • Carriage Return: \\r escape sequence

Supported MySQL Syntax

  • CREATE TABLE: Extracts column names for TOML keys
  • INSERT INTO: Parses data values from INSERT statements
  • Data Types: Handles all MySQL data types (VARCHAR, INT, BOOLEAN, etc.)
  • Quoted Strings: Handles single and double quotes with proper escaping

TOML Applications

  • Cargo: Rust package manager (Cargo.toml)
  • Poetry: Python dependency management (pyproject.toml)
  • Hugo: Static site generator configuration
  • Alacritty: Terminal emulator configuration
  • Netlify: Deployment configuration (netlify.toml)

TOML Advantages

  • Human-Readable: Easy to read and write by humans
  • Minimal: Simple syntax without unnecessary complexity
  • Unambiguous: Clear mapping to hash tables
  • Type-Safe: Explicit data types
  • Comments: Supports comments with # character

Privacy & Security

All conversions happen locally in your browser. Your MySQL data is never uploaded to any server, ensuring complete privacy and security.