- Joined
- Oct 28, 2023
- Messages
- 270
- Thread Author
- #1
SneakyHub has a built in MySQL and MariaDB support!
Name you database anything, but DO NOT PUT ANYTHING FOR CONNECTIONS FROM TAB. That will make it so your Discord Bot cannot access the database.
After, you'll see that the database home has been updated. Press the EYE button to find the connection details.
You've now created your database successfully.
After, go into your bots code, and somewhere in your code enter this:
Fill out the rest of the rest of the required fields. After, you can start your bot and it should successfully say,
Create the Database
Go to the selected SneakyHub Panel Server, and click on the Databases tab. Here, we want to press New Database
Name you database anything, but DO NOT PUT ANYTHING FOR CONNECTIONS FROM TAB. That will make it so your Discord Bot cannot access the database.

After, you'll see that the database home has been updated. Press the EYE button to find the connection details.

You've now created your database successfully.
Connecting to your Discord Bot ( Discord.js )
We're going to use the MySQL package to connect your Discord Bot to our database.
After, go into your bots code, and somewhere in your code enter this:
const mysql = require('mysql');
const db = mysql.createConnection({
host: '10.10.12.243',
user: 'your_username', // your database username, required
password: 'your_password', // the database password that was generated, required
database: 'your_database', // what you named your database, required
});
db.connect((err) => {
if (err) {
console.error('Error connecting to MySQL:', err);
} else {
console.log('Connected to MySQL database');
}
});
Fill out the rest of the rest of the required fields. After, you can start your bot and it should successfully say,
Connected to MySQL database
.