MySQL connection in Deno

Let’s move into another interesting sections, the database where we store information processed. In this post we are connecting MySQL local database using denodrivers.


Our app is a simple Todo application, which store Todo’s in a MySQL database.


This is a third party module for deno which will help us to build a connection to MySQL db. We are going todo the following

  • create a configuration
  • Insert,Update,Delete
  • Querying database


Usually we kept the database file under a config folder, the name of our file will database.ts and content s follows

import { Client } from "";
const client = await new Client().connect({
  hostname: "",
  username: "root",
  db: "todo_collections",
  poolSize: 3, // connection limit
  password: "123",

export default  { client }

You have to specify the host which is localhost, user and password, database name (you should create them first) and we are ready for the controllers.

Published by


A developer,teacher and a blogger obsessed with Python,Dart and open source world from India

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.