Developers LinkApi

Connect to a MySQL Database

Connect to a MySQL database and run dynamic scripts through that library. The library is responsible for connecting to the database, executing the script and closing the connection after execution.

const mysql = require('linkapi-sdk/state/mysql');

const config = {
  credentials: {
    "host": "",
    "username": "",
    "password": "",
    "port": "",
    "database": "",
  }
}

const query = 'SELECT * FROM {{table}}';

const queryValues = {
  table: 'PRODUCTS'
};

const result = await mysql.execute(config);

Updated 3 months ago

Connect to a MySQL Database


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.