MySQL and MariaDB integration: insert, find and update data

The MySQL integration in nana800 runs an SQL query against your MySQL or MariaDB database on every scheme run: it adds a lead, finds an order or changes a status. You only need the connection string from your hosting panel, and the block escapes values from other blocks, so a quote in a name cannot break the query. Each query costs $0.002, and your balance is topped up to $3.50 for free every month.

Build it in the builder
  • Block run: $0.002
  • Free every month: $3.50
  • No card needed

What you can do

  • Add website leads, orders and bot messages as rows to your tables
  • Look up data on request, such as an order by number or a customer by phone or email, and pass it further down the scheme
  • Update and delete rows: mark an order as paid, change its status, remove outdated records
  • Get the id of the row you just inserted into an AUTO_INCREMENT table and use it in the next blocks
  • Put values from other blocks into the query with no SQL injection risk: the block escapes them itself
  • Work with MySQL and MariaDB on AWS RDS, PlanetScale, Aiven, DigitalOcean or your own server, with or without SSL

Blocks in the builder

  • MySQL query

    Action · $0.002 per run

    Runs one SQL command against your MySQL or MariaDB database: SELECT, INSERT, UPDATE, DELETE and others. Returns the rows found, the number of affected rows, the id of a new row and an error text if the query fails.

How to set it up

  1. 1

    Get access to the database

    Copy the connection string from your hosting panel, like mysql://user:password@host:3306/dbname, or note the host, port, database name, user and password. The database must accept connections from the internet: the block refuses localhost and private network addresses like 192.168.x.x.

  2. 2

    Create a scheme and add a trigger

    Create a scheme in the builder and add the trigger that brings the data: a webhook for website leads, a message to a Telegram bot or a schedule. For the first test the button trigger is enough, it starts the scheme by hand.

  3. 3

    Connect the MySQL block

    Add the MySQL external database operation block. Paste the whole connection string or fill in the host, port, database name, user and password. The require SSL mode fits AWS RDS, PlanetScale, Aiven and most cloud databases. If your server has no SSL, choose disable.

  4. 4

    Write the SQL query

    In the SQL query field write one command, for example an insert into your leads table, and put fields from the trigger where the values go. Wrap text in quotes, numbers can go without them. If a table name comes from another block, wrap it in backticks.

  5. 5

    Turn the scheme on and test it

    Turn the scheme on, press the button trigger and open the block result: result holds the rows, row_count their number, insert_id the id of a new row, and error_text the database answer if something went wrong. When it works, keep the scheme on. While it is on, it costs $0.0042 per hour.

Frequently asked questions

Each database query costs $0.002. An enabled scheme costs $0.0042 per hour. Your balance is topped up to $3.50 for free every month, no card needed. A scheme kept on around the clock for a month spends most of that on scheme hours.

MariaDB connects with the same block, and the connection string can start with mysql:// or mariadb://. A database on shared hosting works if it accepts remote connections from the internet. A database that is open only to localhost on its own server is out of reach.

No. The block connects only to databases with a public address: localhost, 10.x.x.x, 172.16.x.x to 172.31.x.x, 192.168.x.x and names like .local are blocked. If the database sits in an office or a private cloud network, open access to it from the internet or move it to a cloud database.

Yes. The block escapes every value from other blocks and inserts it as data, never as part of the command. A quote or a semicolon in a customer name will not break the query or run an extra command. The database password is hidden from project readers and never goes to the logs.

One run of the block executes one SQL command. The block stops a query that runs longer than 15 seconds and waits up to 10 seconds for a connection. Use LIMIT on large selects so you do not carry extra rows down the scheme.

If the table has an AUTO_INCREMENT column, after an INSERT the block puts the new row id into insert_id. You can pass it straight to the next block, for example into a message to a manager with the lead number.

Build your first scheme for free

Sign-up is free and needs no card. Every month the balance is topped up to $3.50 for free, enough for about 3,500 runs of basic blocks.

Build it in the builder