Skip to content

Can I use a database with my Discord bot?

SQLite works without any external service; your database file lives inside your server directory and is read/written directly by your code. It is the simplest option for a bot that does not need to share data across multiple processes.

For PostgreSQL or MySQL, you will need an external database server; Zeros Host does not currently provide managed database hosting alongside Discord bot servers. Use a cloud database provider and connect via your database URL as an environment variable. Store the connection string in the DATABASE_URL startup variable and read it with process.env.DATABASE_URL or os.environ["DATABASE_URL"].

Was this helpful?

Want to try this on a real server?

Everything described here is available on the trial too, on the same hardware and the same panel as the paid plans. Try it free for 24-hour, no credit card required.

Didn't fix it? Ask in Discord.

Ask in our Discord - we help with hosting questions whether or not you host with us.