Skip to main content

MySQL/MariaDB Database Discovery

Tripl-i automatically discovers MySQL and MariaDB instances and databases on Linux servers during SSH scans, providing complete visibility into your MySQL infrastructure alongside other discovered assets.

Overview

When MySQL or MariaDB is detected on a scanned Linux server, the scanner automatically gathers instance configuration, database inventory, active connections, and replication status. The scanner automatically distinguishes between MySQL and MariaDB for accurate CPE generation and vulnerability tracking.

Key Benefits

  • Complete Database Inventory - Discover all MySQL/MariaDB instances and databases across your infrastructure
  • Dependency Mapping - Identify which applications and servers connect to your databases
  • Replication Visibility - Detect primary/replica configurations and replication lag
  • MySQL vs MariaDB Detection - Automatic engine identification for accurate vulnerability matching
  • Vulnerability Management - CPE generation enables CVE tracking for both MySQL and MariaDB
  • Capacity Planning - Track database sizes, table counts, and storage engine distribution

How It Works

Discovery Flow

StepAction
1Linux server is scanned via SSH
2MySQL/MariaDB detected via running processes (mysqld/mariadbd), listening port (3306), or installed binary (mysql)
3Scanner authenticates to MySQL (socket auth or provided credentials)
4Instance configuration, database inventory, connections, and replication status collected
5DatabaseInstance and Database CIs created
6Relationships mapped between instances, databases, and connected servers/workloads

Automatic Triggering

Database discovery is automatically triggered when:

  • A Linux server is scanned via SSH
  • A running mysqld or mariadbd process is detected, or port 3306 is listening, or mysql binary is found
  • No additional configuration is required for servers where the SSH account has sudo access

Authentication

Default: Socket Authentication (No Extra Credentials)

The scanner uses unix socket authentication via sudo:

sudo mysql

This works on most modern MySQL/MariaDB installations where:

  • The SSH scanning account has sudo access
  • MySQL root user is configured for socket authentication (default since MySQL 5.7 and MariaDB 10.4)

No separate database credentials are required in this case.

Optional: Password Authentication

If sudo access is not available, you can configure MySQL credentials in the Scanner GUI:

  1. Go to Credentials tab
  2. Select protocol: MySQL
  3. Enter Username and Password
  4. Set Port (default: 3306)
  5. Set IP Range to target the database server(s)

The scanner uses the MYSQL_PWD environment variable for authentication, keeping passwords out of process listings.

Authentication Priority

PriorityMethodWhen Used
1Provided credentials (MYSQL_PWD)When MySQL credentials are configured
2sudo mysql (socket auth)When SSH user has sudo access
3mysql (current user)Fallback if .my.cnf exists

Required MySQL Permissions

For full discovery, the database user needs:

PermissionPurpose
SELECT on information_schemaDatabase and table inventory
PROCESSActive connection listing
REPLICATION CLIENTReplication status (optional)

The default root user (via socket auth) has all these permissions automatically.

Data Collected

Instance Information

Data PointDescription
VersionFull version string (e.g., 8.0.35, 11.2.2-MariaDB)
Enginemysql or mariadb (auto-detected)
PortListening port (default 3306)
Data DirectoryLocation of database files
Max ConnectionsMaximum allowed connections
InnoDB Buffer Pool SizeInnoDB memory buffer size
Character SetDefault server character set
CollationDefault server collation
Binary Log FormatROW, STATEMENT, or MIXED
GTID ModeGlobal Transaction ID status
SSLWhether SSL is enabled
Is ReplicaWhether this instance is a replication replica
CPECommon Platform Enumeration for vulnerability matching

Database Information

Data PointDescription
Database NameName of the database (schema)
Character SetDefault character set
CollationDefault collation
SizeTotal size in MB (data + index)
Table CountNumber of tables
System Databasemysql, information_schema, performance_schema, sys

Connection Information

Data PointDescription
HostClient IP address
UserMySQL user account
DatabaseTarget database
CommandCurrent operation (Query, Sleep, etc.)
Connection CountNumber of connections from this client

Replication Information

Data PointDescription
Is ReplicaWhether this instance replicates from another
Source HostPrimary/master server hostname

CI Types Created

DatabaseInstance

Represents a MySQL/MariaDB instance running on a server.

  • Naming Convention: ServerName:Port (e.g., db-server-01:3306)
  • Database Engine: mysql or mariadb

Database

Represents an individual database (schema) within an instance.

  • Naming Convention: ServerName:Port/DatabaseName (e.g., db-server-01:3306/production)

Relationships Created

RelationshipSourceTargetDescription
Runs OnDatabaseInstanceServerInstance runs on server
Part OfDatabaseDatabaseInstanceDatabase belongs to instance
Uses DatabaseServer/WorkloadDatabaseInstanceClient connects to database
Linked ToDatabaseInstanceDatabaseInstanceReplication partner

Vulnerability Management

CPE Generation

The scanner auto-detects MySQL vs MariaDB and generates the appropriate CPE:

MySQL: cpe:2.3:a:oracle:mysql:{version}:*:*:*:*:*:*:*

MariaDB: cpe:2.3:a:mariadb:mariadb:{version}:*:*:*:*:*:*:*

Examples:

  • MySQL 8.0.35: cpe:2.3:a:oracle:mysql:8.0.35:*:*:*:*:*:*:*
  • MariaDB 11.2.2: cpe:2.3:a:mariadb:mariadb:11.2.2:*:*:*:*:*:*:*

Best Practices

Security

  • Use socket authentication when possible (no password storage needed)
  • Monitor instances with have_ssl = DISABLED for unencrypted connections
  • Review users with wildcard host access (%)
  • Check for databases using MyISAM engine (no transaction support, no crash recovery)

Monitoring Indicators

  • Binary logging disabled - No point-in-time recovery possible
  • GTID mode OFF - Complicates replication failover
  • High connection count - May indicate connection pool issues
  • Large databases without recent backups - Recovery risk

Troubleshooting

IssueCauseSolution
MySQL not discoveredProcess not running or different portCheck systemctl status mysql on the target
Cannot connectSocket auth not configuredConfigure MySQL credentials in Scanner GUI
Missing databasesInsufficient permissionsGrant SELECT on information_schema
No connection dataMissing PROCESS privilegeGrant PROCESS to the scanning user
No replication statusMissing REPLICATION CLIENTGrant REPLICATION CLIENT privilege