---
title: "Connect to your database service (MongoDB, SQL, Redis)"
url: https://help.endercloud.in/docs/connect-to-your-database-service
category: "Database Hosting"
type: Guide
tags: ["bots", "database", "mysql"]
keywords: "mongodb connection string, mongodb uri, mongodb 8, mongo admin username, database memory, database storage, database price, mariadb connection, mysql host port, postgresql connection string, postgres uri, redis url, redis-cli, authsource admin, authentication failed, database credentials, connect bot to database, database hosting, connect to mongodb, mongodb hosting, redis hosting, postgresql hosting, connection string, change database password, mongodb not connecting"
difficulty: intermediate
time: "10 minutes"
updated: 2026-11-14
source: Endercloud Knowledge Base (official)
---

# Connect to your database service (MongoDB, SQL, Redis)

> Use the host and port shown in the Game Panel with the admin username and password you chose at checkout. Connection strings for MongoDB, MariaDB, PostgreSQL and Redis.

To connect to an Endercloud database service you need four things: the **host**, the **port**, and the **admin username and password** you chose at checkout. Put them into the connection string format for your database type, shown below.

## What you chose at checkout

Database services are hosted in **India** and billed monthly or annually. The base price is ₹50/month (₹600/year), and every order also needs a **Database Memory** and a **Database storage** option. For example, 1 GB memory (+₹15) and 5 GB storage (+₹25) make **₹90/month**. The **Order Summary** at checkout always shows your real total.

-   **MongoDB:** checkout offers **MongoDB 8** (you can change the version later) and asks for a **Database Name**, a **Mongo Admin Username** and a **Mongo Admin Password**. These are the details you connect with.
    
-   **SQL:** you choose **MariaDB** or **PostgreSQL**.
    
-   **Redis** is also available.
    

## Step 1: Find the host and port

1.  Log in to the [billing panel](https://billing.endercloud.in), open **Services** and click your database service.
    
2.  Under **Service Actions**, click **Auto Login to Panel** (or **Access Panel**) to open it in the Game Panel.
    
3.  The header shows the address, for example `in6.endercloud.in:45568`. The part before the colon is the **host**; the number after it is the **port**. The **Dashboard** page shows the same details.
    
4.  Make sure the database is **Online**. Click **Start** if it is stopped.
    

## Step 2: Use your admin username and password

These are the credentials you typed at checkout. Your database appears as a server in the Game Panel, just like a bot, so you can check or change them in its **Startup** tab. After changing them, **Restart** the database and update your app or bot. If anything is unclear, [open a ticket](https://billing.endercloud.in/tickets/create).

> **Warning:**
> If your password contains special characters such as `@`, `:`, `/`, `#` or `%`, they must be *URL-encoded* inside a connection string (for example `@` becomes `%40`). Otherwise the string is read wrongly and login fails.

## Step 3: Build your connection string

Replace `USER`, `PASSWORD`, `HOST` and `PORT` with your own values.

### MongoDB

```
mongodb://USER:PASSWORD@HOST:PORT/?authSource=admin
```

To use the database you named at checkout, add its name after the port: `mongodb://USER:PASSWORD@HOST:PORT/mydb?authSource=admin`. The `authSource=admin` part tells MongoDB where the admin user is stored; without it you often get "Authentication failed". In MongoDB Compass, paste the same string into the connection box.

### MariaDB

MariaDB works with MySQL drivers and tools, so most libraries accept a MySQL-style string:

```
mysql://USER:PASSWORD@HOST:PORT/DATABASE
```

From a terminal (the `mariadb` or `mysql` client):

```
mysql -h HOST -P PORT -u USER -p
```

Note the capital `-P` for the port. In tools like HeidiSQL or DBeaver, fill in host, port, user and password in separate fields.

### PostgreSQL

```
postgresql://USER:PASSWORD@HOST:PORT/DATABASE
```

From a terminal:

```
psql -h HOST -p PORT -U USER -d DATABASE
```

Every PostgreSQL server has a default database called `postgres` that you can connect to first, then create your own.

### Redis

```
redis://:PASSWORD@HOST:PORT
```

If your Redis login uses a username as well, put it before the colon: `redis://USER:PASSWORD@HOST:PORT`. From a terminal:

```
redis-cli -h HOST -p PORT -a PASSWORD
```

Then type `PING`. A reply of `PONG` means you are connected.

## Keep it secure

-   Use a long, unique password with letters, numbers and symbols. Your database can be reached over the internet, so a weak password is a real risk.
    
-   Store the connection string in a `.env` file, never in public code or screenshots. See [Keep your bot token safe with environment variables](/docs/keep-your-bot-token-safe-with-environment-variables).
    
-   Take regular backups from **Backups** and download important ones. See [How to create and restore backups](/docs/how-to-create-and-restore-backups).
    
-   If you need to limit which IP addresses can connect, open a ticket and our team will tell you what's possible for your service.
    

## Troubleshooting

| Error | What to check |
| --- | --- |
| Connection refused / timed out | The database is offline, or the host or port is wrong. Check the panel header. |
| Authentication failed / Access denied | Wrong username or password, special characters not URL-encoded, or (MongoDB) `authSource=admin` missing. |
| SSL or TLS errors | Your client is forcing an encrypted connection. Try with SSL/TLS turned off, or open a ticket to ask what your service supports. |

## Frequently asked questions

**Q: Is this the same as the Databases tab on my Minecraft server?**

No. Game servers include free MySQL databases for plugins, created from the server's **Databases** tab. See [How to create a MySQL database](/docs/how-to-create-a-mysql-database). A database service is a separate product with its own resources.

**Q: Can my bot on Endercloud use this database?**

Yes. Use the same host, port and credentials in your bot's `.env` file.

**Q: Can I use localhost as the host?**

No. Your database runs as its own service, so always use the host and port from the panel.
