Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c04326b
Add MySQL data source connector
erikcurrin-elastic Jul 6, 2026
9a76594
Revamp MySQL connector to conform to current connector-specs conventions
erikcurrin-elastic Jul 6, 2026
66c69ba
Revamp MySQL connector to use ClientTypeSpec framework and add execut…
erikcurrin-elastic Aug 24, 2026
d7aa085
Fix LIMIT binding and extract runSql helper in MySQL connector
erikcurrin-elastic Aug 24, 2026
92920af
Harden MySQL connector review follow-ups: shared SQL guard and TLS.
erikcurrin-elastic Aug 25, 2026
527e444
Merge branch 'main' into mysql-datasource
erikcurrin-elastic Aug 25, 2026
1c4f05a
Changes from node scripts/check
kibanamachine Aug 25, 2026
3ef93d5
Fix mock parameter type in mysql client test
erikcurrin-elastic Aug 25, 2026
4149b2e
Fix CI failures: remove unused mock param and add mysql2 renovate owner
erikcurrin-elastic Aug 26, 2026
7e09a8a
Apply suggestions from code review
erikcurrin-elastic Aug 26, 2026
232b7ec
Fix type errors in mysql.test.ts mock
erikcurrin-elastic Aug 26, 2026
98c7605
PR review response
erikcurrin-elastic Aug 28, 2026
d6d7f15
Merge branch 'main' into mysql-datasource
erikcurrin-elastic Aug 28, 2026
ce6d4cf
Restructure MySQL connector docs per reviewer feedback
erikcurrin-elastic Aug 31, 2026
42b5c23
Apply batched suggestions from code review
erikcurrin-elastic Aug 31, 2026
9606fef
Merge branch 'main' into mysql-datasource
erikcurrin-elastic Aug 31, 2026
d9db712
Merge branch 'main' into mysql-datasource
erikcurrin-elastic Sep 1, 2026
5653166
Move clientTypes to server-only entry to fix Storybook webpack build
erikcurrin-elastic Sep 1, 2026
7397dc2
Block MySQL executable comments to prevent read-only guard bypass
erikcurrin-elastic Sep 1, 2026
a1db970
Fix clientTypes import to use server entry after moving it out of common
erikcurrin-elastic Sep 2, 2026
6ce63b2
Bump mysql2 3.20.0 → 3.24.3 to fix GHSA-3f6p-5ww8-9rcr
erikcurrin-elastic Sep 2, 2026
05c31d7
TO FIX: Run node 'scripts/yarn_deduplicate && yarn kbn bootstrap' loc…
kibanamachine Sep 2, 2026
de81f36
Merge branch 'elastic:main' into mysql-datasource
erikcurrin-elastic Sep 2, 2026
d9c8a12
Fix three PR review findings: UPDATE pattern bypass, dead SSL custom-…
erikcurrin-elastic Sep 4, 2026
25fd233
Update src/platform/packages/shared/kbn-connector-specs/src/lib/gener…
erikcurrin-elastic Sep 4, 2026
2e4837f
Address PR review: scope WRITE_PATTERN to MySQL only, flip executeSql…
erikcurrin-elastic Sep 14, 2026
f798e6d
Merge branch 'main' into mysql-datasource
erikcurrin-elastic Sep 14, 2026
ac3ae10
Merge remote-tracking branch 'upstream/main' into mysql-datasource
erikcurrin-elastic Sep 14, 2026
d884c55
Add mysql2@3.24.3 to pnpm-lock.yaml after pnpm migration merge
erikcurrin-elastic Sep 14, 2026
182f1c2
Merge branch 'main' into mysql-datasource
erikcurrin-elastic Sep 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ lightningcss
tar-fs
browserslist
react-day-picker
mysql2
jszip
@rsdoctor/rspack-plugin
@rspack/core
Expand Down
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -2623,6 +2623,8 @@ src/platform/packages/shared/kbn-connector-specs/src/auth_types/kubernetes_* @el
# Connector Specs
src/platform/packages/shared/kbn-connector-specs/src/all_specs.ts
src/platform/packages/shared/kbn-connector-specs/src/connector_icons_map.ts
src/platform/packages/shared/kbn-connector-specs/src/lib/clients/** @elastic/workchat-eng
src/platform/packages/shared/kbn-connector-specs/src/lib/generic_db_connector* @elastic/workchat-eng
src/platform/packages/shared/kbn-connector-specs/src/lib/mcp/** @elastic/workchat-eng
src/platform/packages/shared/kbn-connector-specs/src/specs/**
src/platform/packages/shared/kbn-connector-specs/src/specs/abuseipdb/** @elastic/workflows-eng
Expand Down Expand Up @@ -2664,6 +2666,7 @@ src/platform/packages/shared/kbn-connector-specs/src/specs/kubernetes/** @elasti
src/platform/packages/shared/kbn-connector-specs/src/specs/microsoft_teams/** @elastic/workchat-eng
src/platform/packages/shared/kbn-connector-specs/src/specs/misp/** @elastic/workflows-eng
src/platform/packages/shared/kbn-connector-specs/src/specs/monday_com/** @elastic/workchat-eng
src/platform/packages/shared/kbn-connector-specs/src/specs/mysql/** @elastic/workchat-eng
src/platform/packages/shared/kbn-connector-specs/src/specs/notion/** @elastic/workchat-eng
src/platform/packages/shared/kbn-connector-specs/src/specs/okta/** @elastic/workflows-eng
src/platform/packages/shared/kbn-connector-specs/src/specs/one_drive/** @elastic/workchat-eng
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
- [Kubernetes](/reference/connectors-kibana/kubernetes-action-type.md): Read and modify resources in a Kubernetes cluster through its REST API.
- [Microsoft Teams](/reference/connectors-kibana/microsoft-teams-action-type.md): Search messages and browse teams, channels, and chats in Microsoft Teams.
- [Monday.com](/reference/connectors-kibana/monday-com-action-type.md): Search boards, read and create items, post updates, and manage workspaces in Monday.com.
- [MySQL](/reference/connectors-kibana/mysql-action-type.md): Query tables, search rows, explore schema, and execute SQL in a MySQL database.

Check notice on line 36 in docs/reference/connectors-kibana/_snippets/data-context-sources-connectors-list.md

View workflow job for this annotation

GitHub Actions / build / vale

Elastic.WordChoice: Consider using 'run, start' instead of 'execute', unless the term is in the UI.
- [New Relic](/reference/connectors-kibana/new-relic-action-type.md): Acknowledge and resolve AI issues, manage muting rules, and run NRQL queries.
- [Notion](/reference/connectors-kibana/notion-action-type.md): Explore content and databases in Notion.
- [OneDrive](/reference/connectors-kibana/one-drive-action-type.md): Search files and folders, browse drives, read file content, and list files shared with you in Microsoft OneDrive.
Expand Down
133 changes: 133 additions & 0 deletions docs/reference/connectors-kibana/mysql-action-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
---
navigation_title: "MySQL"
type: reference
description: "Use the MySQL connector to query, explore schema, and execute SQL against a MySQL database."

Check notice on line 4 in docs/reference/connectors-kibana/mysql-action-type.md

View workflow job for this annotation

GitHub Actions / build / vale

Elastic.WordChoice: Consider using 'run, start' instead of 'execute', unless the term is in the UI.
applies_to:
stack: preview 9.6
serverless: preview
---

# MySQL connector [mysql-action-type]

The MySQL connector connects directly to a MySQL database so you can search, query, and explore schema from chat conversations. Workflow authors can also run write or DDL statements through **Execute SQL**.

Check notice on line 12 in docs/reference/connectors-kibana/mysql-action-type.md

View workflow job for this annotation

GitHub Actions / build / vale

Elastic.WordChoice: Consider using 'run, start' instead of 'Execute', unless the term is in the UI.

## Requirements [mysql-requirements]

The MySQL connector connects directly to MySQL over the native MySQL protocol (default port 3306). Your MySQL server must be network-accessible from your Kibana instance. TLS is required by default.

To use the MySQL connector, you need:

1. A MySQL server accessible from your Kibana instance.
2. A MySQL user with access to the databases you want to query.
3. The server hostname, port, database name, and credentials.

## Get connection details [mysql-api-credentials]

To configure the connector:

1. Identify the hostname or IP address of your MySQL server.
2. Create a MySQL user with the appropriate permissions for your use case (see [Database user permissions](#mysql-security)).
3. Note the server port (default: 3306) and the default database name.

## Create connectors in {{kib}} [define-mysql-ui]

You can create connectors in **{{stack-manage-app}} > {{connectors-ui}}**.

### Connector configuration [mysql-connector-configuration]

MySQL connectors have the following configuration properties:

Host
: The hostname or IP address of the MySQL server (for example, `mysql.example.com`, `192.168.1.1`, `localhost`). Do not include a protocol prefix.

Port
: The port number of the MySQL server (default: 3306).

Database
: The name of the default database to query.

Username
: The MySQL user to authenticate as.

Password
: The password for the MySQL user.

TLS
: Whether to encrypt the connection. **Required** (default) uses Kibana TLS settings. **Disabled** is only for servers that do not support TLS.


## Test connectors [mysql-action-configuration]

You can test connectors as you're creating or editing the connector in {{kib}}.

Comment thread
erikcurrin-elastic marked this conversation as resolved.
## MySQL Connector actions [mysql-connector-actions]

The MySQL connector has the following actions:

Query
: Run a read-only SQL query against the MySQL database.
- **sql** (required): The SQL query to run. Include a `LIMIT` clause to bound the result size. Do not include a trailing semicolon.

List Databases
: List all databases accessible to the authenticated user.

List Tables
: List all tables in a database.
- **database** (optional): The database name. Uses the configured default if omitted.

Describe Table
: Describe the schema of a table, including column names, types, and constraints.
- **table** (required): The table name to describe.
- **database** (optional): The database name. Uses the configured default if omitted.

Search Rows
: Search rows in a table by matching a search term against specified columns.
- **table** (required): The table to search.
- **searchTerm** (required): The text to search for.
- **columns** (required): Array of column names to search in. Use `describeTable` to discover available columns.
- **maxRows** (optional): Maximum number of rows to return (1-1000, default: 100).
- **database** (optional): The database name. Uses the configured default if omitted.

Execute SQL

Check notice on line 91 in docs/reference/connectors-kibana/mysql-action-type.md

View workflow job for this annotation

GitHub Actions / build / vale

Elastic.WordChoice: Consider using 'run, start' instead of 'Execute', unless the term is in the UI.
: Run any SQL statement against the MySQL database. No restrictions — `INSERT`, `UPDATE`, `DELETE`, `DROP`, and DDL are all permitted. Use only when the workflow explicitly requires a write or destructive operation. Prefer **Query** for read-only access.
- **sql** (required): The SQL statement to execute.


## Database user permissions [mysql-security]

The permissions you grant to the MySQL user determine what the connector can do. Configure them to match your intended use case.
Comment thread
erikcurrin-elastic marked this conversation as resolved.

### Read-only chat use case (recommended)

For chat conversations, where the goal is to query and explore data, use a dedicated user with only `SELECT` access. This is the recommended configuration and provides the strongest protection against unintended modifications.

```sql
-- Create a read-only user and grant SELECT on the target databases
CREATE USER 'kibana_reader'@'%' IDENTIFIED BY '<password>';
GRANT SELECT ON my_database.* TO 'kibana_reader'@'%';
FLUSH PRIVILEGES;
```

The `query` action enforces read-only access at the application level by accepting only `SELECT` and `WITH` statements and by blocking multi-statement input. Use **List Tables** and **Describe Table** for schema discovery.

::::{note}
The application-level read-only check is not a security guarantee. Prompt injection and other techniques may craft inputs that bypass it. The only reliable protection is granting the database user read-only permissions. Application-level enforcement is a defense-in-depth measure, not a substitute for least-privilege credentials.

Check notice on line 114 in docs/reference/connectors-kibana/mysql-action-type.md

View workflow job for this annotation

GitHub Actions / build / vale

Elastic.WordChoice: Consider using 'can, might' instead of 'may', unless the term is in the UI.
::::

Using a least-privilege database user adds a second, independent layer of enforcement. Note: the `executeSql` action bypasses these restrictions and can run any statement — do not grant write privileges unless your use case requires them.

You can further restrict the user to connections from your Kibana host's IP address:

```sql
CREATE USER 'kibana_reader'@'<kibana-host-ip>' IDENTIFIED BY '<password>';
```

### Broader access

If your use case requires write access or access across multiple databases, grant the appropriate privileges to the MySQL user. Scope permissions as narrowly as possible for your use case.

```sql
-- Example: grant read/write access to a specific database
GRANT SELECT, INSERT, UPDATE, DELETE ON my_database.* TO 'kibana_user'@'%';
FLUSH PRIVILEGES;
```
1 change: 1 addition & 0 deletions docs/reference/toc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
project: 'Kibana reference'
toc:
- file: index.md
Expand Down Expand Up @@ -118,6 +118,7 @@
- file: connectors-kibana/microsoft-teams-action-type.md
- file: connectors-kibana/monday-com-action-type.md
- file: connectors-kibana/misp-action-type.md
- file: connectors-kibana/mysql-action-type.md
- file: connectors-kibana/new-relic-action-type.md
- file: connectors-kibana/notion-action-type.md
- file: connectors-kibana/okta-action-type.md
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1562,6 +1562,7 @@
"monaco-yaml": "5.1.0",
"murmurhash": "2.0.1",
"mustache": "4.2.0",
"mysql2": "3.24.3",
"node-diff3": "3.1.2",
"node-fetch": "2.7.0",
"node-forge": "1.4.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/kbn-optimizer/src/worker/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ export function getWebpackConfig(
}
const sharedExternals: Record<string, string> = {
'node:crypto': 'commonjs crypto',
mysql2: 'commonjs mysql2',
'mysql2/promise': 'commonjs mysql2/promise',
...UiSharedDepsSrc.externals,
};
if (request && request in sharedExternals) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { getExternals, isKeaReactReduxImport } from './externals';
* Rspack-specific externals that are NOT in UiSharedDepsSrc.externals.
* Any addition here must be intentional and documented.
*/
const RSPACK_ONLY_EXTERNALS = ['node:crypto'];
const RSPACK_ONLY_EXTERNALS = ['node:crypto', 'mysql2', 'mysql2/promise'];

describe('externals configuration', () => {
const rspackExternals = getExternals();
Expand Down
3 changes: 3 additions & 0 deletions packages/kbn-rspack-optimizer/src/config/externals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,8 @@ export function getExternals(): Record<string, string> {

// Node.js built-ins (rspack-specific, for browser compatibility)
'node:crypto': 'commonjs crypto',
// Native MySQL driver — keep out of the browser bundle (mirrors webpack).
mysql2: 'commonjs mysql2',
'mysql2/promise': 'commonjs mysql2/promise',
};
}
58 changes: 58 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -2555,6 +2555,15 @@
"enabled": true,
"minimumReleaseAge": "14 days"
},
{
"groupName": "mysql2",
"matchDepNames": ["mysql2"],
"reviewers": ["team:response-ops"],
"matchBaseBranches": ["main"],
"addLabels": ["Team:ResponseOps"],
"minimumReleaseAge": "14 days",
"enabled": true
},
{
"groupName": "react-day-picker",
"matchDepNames": ["react-day-picker"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ export {
} from './src/auth_mode_by_auth_type_id';
export { getMeta, setMeta, addMeta } from './src/connector_spec_ui';
export type { BaseMetadata } from './src/connector_spec_ui';
export { clientTypes } from './src/lib/clients';
export type {
ClientTypeSpec,
BuildContext,
Expand Down
2 changes: 2 additions & 0 deletions src/platform/packages/shared/kbn-connector-specs/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ export const authTypeSpecs = {
KubernetesEksAuth,
KubernetesGkeAuth,
};

export { clientTypes } from './src/lib/clients';
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export * from './specs/google_cloud_storage/google_cloud_storage';
export * from './specs/sharepoint_server/sharepoint_server';
export * from './specs/microsoft_teams/microsoft_teams';
export * from './specs/monday_com/monday_com';
export * from './specs/mysql/mysql';
export * from './specs/outlook/outlook';
export * from './specs/tavily/tavily';
export * from './specs/pagerduty/pagerduty';
Expand Down
Loading
Loading