MySQL to TOML Converter
Transform MySQL database dumps into TOML (Tom's Obvious, Minimal Language) configuration format for modern applications
MySQL Input
Convert MySQL to other formats
TOML Output
Convert other formats to TOML
Related Tools
MySQL to TracWiki
Convert MySQL CREATE TABLE and INSERT statements to TracWiki table markup format for Trac project management
MySQL to XML
Convert MySQL CREATE TABLE and INSERT statements to XML format with customizable structure and formatting
MySQL to YAML
Convert MySQL CREATE TABLE and INSERT statements to YAML format for configuration and data serialization
SQL to ActionScript
Convert SQL CREATE TABLE and INSERT statements to ActionScript arrays, vectors, and objects for Flash/AIR
SQL to ASCII
Convert SQL database dumps to ASCII table format with borders and alignment
SQL to AsciiDoc
Convert SQL CREATE TABLE and INSERT statements to AsciiDoc table markup for technical documentation
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
- Input MySQL Data: Paste your MySQL CREATE TABLE and INSERT statements or upload a .sql file
- Choose Format: Select array of tables or inline tables format
- Configure Options: Toggle metadata comments
- 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.
FAQ
- What is the difference between array-of-tables and inline tables? Array-of-tables uses repeated
[[table]]sections, while inline tables keep each row on a single line inside[{...}]. Both represent the same data in TOML. - How are NULL or empty values represented? Empty or NULL MySQL values are converted to empty strings (
"") in TOML so that the file remains valid and easy to parse. - Does the tool detect dates or arrays? This converter focuses on basic scalars (strings, numbers, booleans). Complex TOML types like dates or nested arrays must be adjusted manually after export if needed.
- Why are some keys renamed? Column names are sanitized to valid TOML keys (no spaces, no leading digits, limited punctuation) to avoid parse errors in TOML parsers.
- Can I safely use the output in production configs? Yes, but you should review and test the generated TOML in your actual application or tooling before deploying.
