Skip to content

MySQL Tables

Menu: Database → MySQL Tables
Deep link: /_Admin/database/mysql-table?SiteId={siteGuid}

MySQL tables let you browse and manage tables in an connected external MySQL database from the admin: create tables, maintain columns and data, and import / export CSV. Configure the Mysql connection string under Service integrations first; scripts use k.DB.mysql for SQL or table objects. Child routes must include dbType=MySql; the left menu highlights MySQL Tables.

Permissions

Same as SQLite tables: database (view), database·edit, database·delete.
Configuring the connection string requires Service integrations config·edit.

Difference from SQLite tables

MySQL tablesSQLite tables
Data sourceExternal MySQL (connection string)Site built-in SQLite file
PrerequisiteService integrations Database → MysqlNo configuration
When not configuredGuided page + Configure nowLists tables directly
Column / data UISame as SQLite (no primary key/unique columns; has CSV)Same
Scriptk.DB.mysqlk.DB.sqlite
SQL log typemysqlsqlite

Column editing and data browsing share views/database/table/* routes with IndexedDB / SQLite.

Configure MySQL connection

  1. Open Site settings → Service integrations: /_Admin/system/config?SiteId={siteGuid}
  2. Expand the Database group and edit Mysql. See Service integrations · Database.
  3. Enter the connection string (ConnectionString) and save.

Example format (follow Kooboo built-in guidance):

text
Server=myServerAddress;Port=3306;Database=myDataBase;Uid=myUsername;Pwd=myPassword;

You can also click Configure now on the MySQL Tables unconfigured guide page to jump to /_Admin/system/config?SiteId={siteGuid}&group=Database (Database group expanded automatically).

Security

Connection strings contain credentials; do not commit them to public repositories. Use least-privilege database users in production.

How to Open

  1. In Edit Menu, check Database → MySQL Tables.
  2. Complete Configure MySQL connection.
  3. Open Database → MySQL Tables in the left sidebar.

When not configured or the connection is invalid, the page shows an error and Configure now; no table list is shown.

MySQL unconfigured guide

After a successful connection, list, columns, data, CSV import, and other UIs share the same pages as SQLite tables (only dbType=MySql and menu highlight differ). Screenshots below use SQLite as an example; MySQL looks the same once configured.

Table List

ActionPermissionDescription
Create tabledatabase·editCreate table in MySQL and register admin schema
Click NamedatabaseOpen table data
Settings (gear)databaseOpen column settings
Multi-select Deletedatabase·deleteDelete selected physical tables (use with care)

Table name rules match IndexedDB / SQLite: 1–50 characters, letter or digit start, letters and digits only.

Table list (same UI as SQLite tables)Create table toolbarTable name list example

Create table dialog

Create table dialog

Column Settings

Route example:

text
/_Admin/database/table/columns?SiteId={siteGuid}&table={tableName}&dbType=MySql

Same as SQLite column settings: list shows column name, control type, index (no primary key/unique columns); column editor has no length, auto-increment, or primary key/unique (IndexedDB only). Save updates MySQL table structure and admin control mapping.

Column settings (same UI as SQLite tables)Column editor dialog

Table Data

Route example:

text
/_Admin/database/table/data?SiteId={siteGuid}&table={tableName}&dbType=MySql

Toolbar

ButtonPermissionDescription
New datadatabase·editOpen edit page
Export datadatabaseExport CSV
Import datadatabase·editCSV import
SettingsJump to column settings
Table data toolbarTable data list

CSV import

Fields and flow match SQLite CSV import: skip rows, upload .csv, field mapping (required/unique), optional overwrite.

CSV import dialog

Edit Data

Route example:

text
/_Admin/database/table/edit-data?SiteId={siteGuid}&table={tableName}&dbType=MySql

Form rendered by column control type; Save / Cancel returns to the data list.

Script access (development)

typescript
const rows = k.DB.mysql.query(
  "SELECT * FROM orders WHERE id = @id",
  { id: 1 }
)
k.DB.mysql.execute(
  "INSERT INTO orders (order_no, amount) VALUES (@no, @amt)",
  { no: "A1001", amt: 99 }
)
const table = k.DB.mysql.getTable("orders")

When Default database under Site settings → Advanced is set to Mysql, k.DB.sql and k.DB.mysql point to the same instance.

See k.DB (mysql and sqlite share relational APIs: query / execute / getTable, etc.).

SQL logs

With site SQL logging enabled, statements from k.DB.mysql can be filtered by type MySQL in SQL logs.

Typical workflow

  1. Configure Mysql under Service integrations and verify connectivity.
  2. Open MySQL Tables, Create table or sync existing database tables (tables already in the database appear in the list).
  3. Settings for columns and control types; New data or Import CSV.
  4. Read/write in Code with k.DB.mysql; check SQL logs when troubleshooting.
DocDescription
SQLite tablesBuilt-in database; no connection
SQL Server tablesSimilar external database
k.DBScript API
SQL logsExecution records
Database overviewMenu overview