MySQL
Connect a command-line MySQL client to a Data Product and query its semantic models.
Query semantic models from the terminal with mysql classic client. The semantic layer already handles joins, aggregations, and transformations, so you write plain SQL. See the Query Guide for SQL examples, supported syntax, and tips.
Prerequisites
Classic MySQL client
The standard mysql command-line client. Install steps for Windows and macOS below.
DataOS username
Your DataOS ID. Used as the connection username.
DataOS API token
Your DataOS API token. Used as the password. Get it from Before you begin.
Install on Windows
First-time setup only. Skip to Connect if mysql --version already works.
1. Download the installer
Get MySQL Installer Community: link and pick mysql-installer-web-community.
2. Install components
Launch MySQL Installer.
Click Add….
Expand MySQL Servers.
Pick MySQL Server 8.0 (or the latest available).
Click > to add it, then Next, then Execute.
Installing the MySQL Server is the easiest way to get
mysql.exe. You won't use the local database with DataOS; it's just there to provide the client.
3. Configure the local server
Accept the defaults at each screen:
Type and Networking: Development Computer, TCP/IP enabled, Port 3306, Open Windows Firewall Ports → Next.
Authentication Method: Use Strong Password Encryption (Recommended) → Next.
Accounts and Roles: set any root password (e.g.
root123) → Next.Windows Service: keep "Configure MySQL Server as Windows Service" and "Start at System Startup" → Next.
Apply Configuration: click Execute, wait for green checkmarks, then Finish.
4. Add MySQL to PATH
Press Win + R and run
sysdm.cpl.Go to Advanced → Environment Variables → System Variables → Path → New.
Add:
Click OK, close and reopen PowerShell.
5. Verify
Expected:
Confirm the executable location:
Expected:
Install on macOS
First-time setup only. Skip to Connect if mysql --version already works.
Official package
Download the MySQL Community Server DMG from the download page that matches your system configuration, then install it.
Verify
Expected:
Connect
In the Data Product, go to Activate → Database Client and open the MySQL guide. Starting there saves you from assembling the command yourself: the in-product guide gives you a ready-to-run connection command and a sample query for the selected Data Product.
Copy the command, drop in your username, API token, and database, then run it:
Example:
Or omit the key after -p and you'll be prompted for it:
Parameters:
-h
Your DataOS TCP host
-P 3306
MySQL wire protocol port
-u
Your DataOS username
-p
Your DataOS API token (no space between -p and the value)
--enable-cleartext-plugin
Required. Enables cleartext authentication over TLS.
Last argument
<tenant>.<data-product-name>: the semantic model to connect to
API token format: Wrap the key in single quotes if it has special characters, e.g.
-p'abc123=='.
Query your data
Once connected, run SQL against the semantic model:
See the Query Guide for SQL examples, supported syntax, and tips.
Troubleshooting
Access denied
API token is wrong or expired. Get a fresh one from the Tokens tab and retry.
Unknown database
The <tenant>.<data-product-name> value is off. Copy the exact name from the Data Product page.
Connection times out
Port 3306 is probably blocked. Check VPN and firewall rules between your machine and the DataOS TCP host.
cleartext plugin not loaded
You're missing --enable-cleartext-plugin.
mysql: command not found / 'mysql' is not recognized
The MySQL bin directory isn't on your PATH. Re-check the install steps and reopen your terminal. On Windows, verify with dir "C:\Program Files\MySQL" -Recurse -Filter mysql.exe.
mysqlsh: unknown option --enable-cleartext-plugin
You're using MySQL Shell (mysqlsh). Use the classic mysql.
For the full query reference, including the SQL form, aggregate functions, and filter operators, see the query reference in References.
Last updated
Was this helpful?