How to connect to a MySQL database?

Hello!

I’ve recently decided to move my Discord.js bot back to Glitch after finding that packages like libsodium, etc wouldn’t install on my self-hosted machine. One of the big issues with Glitch is the storage. Let’s face it, you only get 194MB of on-disk storage, not enough to hold the data I will require in the future. So, I have set up my own MySQL database, I looked through https://glitch.com/storage. Thus, I found no project template thingy on how to connect to a MySQL DB.

In other words,

How do I connect to a MySQL database via Glitch.

I have my DB name, username, password & hostname.

Any help would be appreciated!

- Charlie

The MySQL node.js package is pretty well documented, see https://github.com/mysqljs/mysql#readme

2 Likes

Thank you! I had searched his up before but when I saw the word driver I thought it was better to check that it was fine.

How to make changes to mysql without su password? any ideas?