Deploy n8n MySQL
MySQL rows to Slack & Sheets
Just deployed
/home/node/.n8n
Redis
Just deployed
/data
Just deployed
/var/lib/postgresql/data
n8n-worker
Just deployed
Deploy and Host self hosted n8n MySQL (Open-Source MySQL Automation) on Railway
A MySQL row changes at 3 a.m. - new order, status flip, cleanup job. Slack should know in seconds, and your report should reflect it by morning. This n8n queue-mode stack does that without making webhooks wait behind a long SELECT.
About Hosting n8n MySQL open-source software on Railway (self hosted n8n template)
This template gives you two n8n instances: an editor for building flows, and a worker that only processes queue jobs. The MySQL node speaks plain SQL, so you write the same query you would in a terminal.
Queue mode is the quiet hero. In default n8n, a heavy query against a large table blocks the event loop. With queue mode, the editor only schedules jobs and answers webhooks instantly.
Postgres, Redis, editor, and worker share one Railway project over private networking; add a second worker and Redis splits jobs across both.
Why Deploy n8n MySQL, the Zapier alternative on Railway (Railway Free Trial)
Zapier treats databases as an afterthought. MySQL is a premium app, triggers poll on your plan's interval, and every new row that fires a Zap burns tasks. Want a query that joins three tables and reshapes the result before Slack?
n8n Community Edition inverts that. The MySQL node runs arbitrary SELECTs, cron schedules on your terms, and Slack/Google Sheets nodes are first-class. No per-execution toll.
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying n8n MySQL on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Railway vs Other Hosting Providers and VPS for n8n MySQL self hosting
| Feature | Railway | DigitalOcean | AWS | Hetzner |
|---|---|---|---|---|
| Queue-mode setup effort | Deploy template, env vars pre-wired | Manual docker-compose, networking DIY | Terraform or console wizard, IAM sprawl | Full manual setup |
| Postgres + Redis provisioning | One-click, private networking | Managed databases cost extra | RDS + ElastiCache, separate bills | Self-install or managed add-on |
| Horizontal worker scaling | Resize or replicate in UI | Resize droplet | Autoscaling groups | Add VPS, configure Redis |
| Predictable pricing | ~$10-$25/month all-in | $24+ droplet plus DB fees | Variable, easy to overspend | Cheapest compute, most ops overhead |
Hetzner wins on raw compute price. But you handle Postgres, Redis, TLS, backups, monitoring. Railway trades slightly higher base cost for much less operational tax.
Common Use Cases for hosted n8n MySQL
Row-change alerts. A Schedule Trigger fires every minute, a query pulls rows updated since the last run, and Slack gets a message per new order or failed payment.
Morning reports. A nightly query rolls up yesterday's signups, refunds, and revenue by plan, then appends one row to the Google Sheet finance already reads.
Data hygiene. A weekly job finds orphaned rows, duplicate emails, or orders stuck in pending and posts the list for a human to approve before anything is deleted.
Dependencies for n8n MySQL Docker hosted on Railway
Queue mode trips people up. You cannot run it on SQLite - the database must be Postgres because n8n stores execution state, credentials, and workflow definitions there while Redis Bull manages the job queue.
Deployment Dependencies for Managed n8n MySQL Service (MySQL Workflow Automation)
This Railway template provisions three backing services: Postgres for internal state, Redis for the Bull queue, and a persistent volume at /home/node/.n8n for files and binary data.
EXECUTIONS_MODE=queue tells n8n to hand jobs to Redis. DB_TYPE=postgresdb points internal state at Postgres.
Implementation Details for n8n MySQL (Using n8n official docker image)
MySQL is a built-in core node in the official image, so no custom Dockerfile is needed. In the editor, create a MySQL credential with host, port, user, password, database name.
Queue mode changes one behavior: the editor doesn't run the query. It validates, serializes, publishes to Redis. The worker picks it up, runs the query, sends results through remaining nodes.
How does n8n MySQL compare against other database automation platforms
n8n sits between connector platforms and pipeline tools: it runs SQL, then branches, transforms, and fans out.
n8n MySQL vs Zapier (Zapier Alternative)
Zapier's MySQL app can trigger on new rows and create or update rows, but it is a premium app and 50 new rows means 50 Zap runs, each burning tasks. n8n runs any SQL in any step with no per-execution cost.
n8n MySQL vs Make (Make Alternative)
Make's MySQL module supports writes and has a nice visual mapper. Routers handle branching, but every module run is a billed operation, a minute-by-minute poll adds up fast, and there is no self-hosted option. n8n's node graph handles parallel branches, error catching, retries more cleanly.
n8n MySQL vs Airbyte (Airbyte Alternative)
Airbyte is for replication, not reaction. It moves data from MySQL to warehouses on schedule, but no Slack alerting, no Google Sheets output, no branching.
n8n MySQL vs Retool Workflows (Retool Workflows Alternative)
Retool Workflows can query MySQL and integrates with Retool's frontend builder. If you need a button in an internal dashboard triggering a query, Retool is cleaner. n8n wins when the trigger is a schedule or webhook and the output is Slack, Sheets, or another API.
How to use n8n MySQL (the OSS MySQL Workflow Automation)?
Start by creating a MySQL credential in the editor. Use a dedicated database user with only needed permissions - SELECT for reporting, INSERT/UPDATE for write-back.
Drag a Schedule Trigger onto the canvas. For row-change alerts, use a one-minute interval and filter on an indexed updated_at column. For nightly reports, a custom cron like 55 23 * * *. Set GENERIC_TIMEZONE, or that report fires at the wrong hour.
MySQL node's "Execute Query" returns rows as JSON, passed to subsequent nodes. In Slack node, use expression {{ $json.customer }} to interpolate. In Google Sheets, map query columns to sheet columns.
Queue mode keeps editor responsive even when cron fires 200 jobs. Each worker runs up to 10 jobs in parallel by default; add worker replicas if schedules overlap.
How to self host n8n MySQL on other VPS Services (n8n MySQL self hosting guide)
If you prefer bare infrastructure, the same stack runs on any Linux VPS with Docker.
Clone the Repository
n8n doesn't require cloning - the official Docker image is canonical. But pin configuration by creating a project directory and docker-compose.yml declaring editor, worker, Postgres, Redis.
Install Dependencies
Install Docker Engine and Compose plugin. Create volumes for Postgres data and n8n's /home/node/.n8n. Pull pinned image with docker pull n8nio/n8n:2.36.8.
Configure Environment Variables
Create .env alongside compose with EXECUTIONS_MODE=queue, DB_TYPE=postgresdb, the DB_POSTGRESDB_* host and password values, QUEUE_BULL_REDIS_HOST, one long random N8N_ENCRYPTION_KEY shared by editor and worker, WEBHOOK_URL, and N8N_PROXY_HOPS=1 behind a TLS proxy.
Start the n8n MySQL Application
Run docker compose up -d, then check logs for editor and worker. Once editor says "accessible on port 5678", open URL, create MySQL credential, build first flow. Test webhook with curl to confirm proxy and N8N_PROXY_HOPS.
Official Pricing of n8n MySQL (n8n MySQL pricing)
n8n Community Edition is free under fair-code license - no seat fees, no execution caps, no trial expiration. You pay only for infrastructure. n8n Cloud starts around $24/month for 2,500 executions.
n8n MySQL cloud vs self hosted comparison (Pricing, features, costs, and more)
n8n Cloud removes operational burden - patches, backups, key management, queue tuning.
Monthly cost of self hosting n8n MySQL on Railway
Baseline around $10/month: minimal Postgres, Redis, one worker, editor. Add second worker for concurrency: $15-$20. Storage growth controlled by EXECUTIONS_DATA_PRUNE=true.
System Requirements for Hosting n8n MySQL on a VPS
Single editor and one worker on same VPS: floor 2 vCPU, 4 GB RAM. Postgres and Redis use ~500 MB under light load, n8n processes another 500 MB-1 GB, heavy queries spike memory.
Frequently Asked Questions (FAQs)
Can I run queue mode with SQLite instead of Postgres?
No. For single-instance without Postgres, use the cheapest n8n without queue mode template - a single instance with no Redis or worker, fine for light workloads.
What happens if my Redis queue fills up?
Redis Bull uses in-memory storage, so a flood can exhaust RAM. EXECUTIONS_DATA_PRUNE=true only cleans Postgres, not Redis. Monitor Redis memory in Railway, add a second worker if queue latency climbs.
Do I need to open MySQL to the public internet for n8n to connect?
Avoid it. If MySQL runs in the same Railway project, connect over private networking with its .railway.internal hostname. If it lives elsewhere, require TLS, use a least-privilege user, and allowlist only n8n. On a VPS, bind MySQL to a private interface.
How do I avoid re-alerting on the same rows every cron run?
Track a cursor - timestamp or auto-increment ID - and query only rows newer than last successful run. Store cursor in n8n static data or a small Postgres table, update after alert succeeds.
What's the biggest gotcha with N8N_ENCRYPTION_KEY?
Lose or rotate it and every stored credential, MySQL password included, becomes undecryptable with no recovery path. Generate it once and keep it in a password manager.
Template Content
Redis
redis:8.2n8n-worker
n8nio/n8n:2.36.8