# MySQL

## Set up a MySQL connection

When inside a workbook, click **View** > **Databases**, then click the **+** icon and follow the on-screen instructions.

![Create a MySQL connection](https://4179539225-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZqboFGZzD87nn7oPsm%2Fuploads%2Fb4lZRy3caLGWeP4q8qMw%2FScreenshot%202023-06-30%20at%2013.56.47.png?alt=media\&token=c646d17e-af7d-49f6-9bf8-a1732e7eeefa)

For detailed instructions, see [connect-your-data-to-workspace](https://datalab-docs.datacamp.com/connect-to-data/connect-your-data-to-workspace "mention").

If you want to experiment with MySQL without setting up a connection, you can use our sample database with employees data ([source](https://dev.mysql.com/doc/employee/en/)).

## Query the database

You can now query your MySQL database with a [sql-cell](https://datalab-docs.datacamp.com/work/sql-cell "mention"). Select it in the **Select source** dropdown in the top left corner of a SQL cell, or select the sample MySQL database.

![Example of a SQL cell using the employees-test database connection. The query result is available as employees\_df.](https://4179539225-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZqboFGZzD87nn7oPsm%2Fuploads%2FZqAWYkczYdJ5pKExSgzT%2Fimage.png?alt=media\&token=879d3efe-ee94-46ba-aed7-9d31d34a1646)

###


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://datalab-docs.datacamp.com/connect-to-data/mysql.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
