> For the complete documentation index, see [llms.txt](https://docs.graphite-note.com/graphite-note-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.graphite-note.com/graphite-note-documentation/~/changes/E2AMshWWxt1bMPRlFt2a/datasets/data-sources-in-graphite-note/connect-to-your-database.md).

# Connect to your database

If you are using SQL for your database, you can connect to it and write your own SQL.

To connect to your database:

1. Go to *Create New* on *Datasets*, or *New Dataset* when you are in the datasets list

<figure><img src="https://3727300098-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgnR78y9L7FDWeb4jdvdW%2Fuploads%2F9u9yFCvhjDkbfnnbt8nl%2Fimage.png?alt=media&amp;token=8c901442-b1c1-4baa-8231-9a1bf13e0744" alt=""><figcaption></figcaption></figure>

2. Chose *MySQL/MariaDB* or *PostgreSQL*

<figure><img src="https://3727300098-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgnR78y9L7FDWeb4jdvdW%2Fuploads%2FdpLItD8a2bmurxuDU5Xc%2Fimage.png?alt=media&amp;token=6415ccc9-a7ac-4666-8410-998cf5c849e1" alt=""><figcaption></figcaption></figure>

3. If you want, you can name the dataset, write down a short description of the data and add a [tag](/graphite-note-documentation/~/changes/E2AMshWWxt1bMPRlFt2a/account-and-team-setup/faq.md#what-is-a-tag)

<figure><img src="https://3727300098-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgnR78y9L7FDWeb4jdvdW%2Fuploads%2FQHREQIwrldH1E0pYtGi6%2Fimage.png?alt=media&amp;token=79acb9b3-e3e1-4141-b0f8-e82d90dbd664" alt=""><figcaption></figcaption></figure>

4. Establish a connection

* Enter your server hostname/IP address, database port, database user, database password, and database name
* Select *Check Connection*
* Ensure that your firewall accepts incoming requests from the following two IP addresses: 99.81.63.220 and 68.183.64.54

<figure><img src="https://3727300098-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgnR78y9L7FDWeb4jdvdW%2Fuploads%2FBtejak4hoEmMODD7UhmG%2Fimage.png?alt=media&amp;token=ba463834-bd05-4043-9fdc-d246a682b1a0" alt=""><figcaption></figcaption></figure>

5. Write the desired SQL and click on the *Run SQL* button to get your data

You should see all the columns from the selected dataset appearing. If necessary, you can change column names, data types, or data formats

6. Click on the *Create* button to create your dataset

It's much easier to get data from databases using SQL - you can adjust the dataset to your needs! By repeating the above steps, you can easily get your data and start running various models without writing down any line of code.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.graphite-note.com/graphite-note-documentation/~/changes/E2AMshWWxt1bMPRlFt2a/datasets/data-sources-in-graphite-note/connect-to-your-database.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
