R
Railway•2y ago
Fragly

Handshake timeout error on mySQL

// ---> DATABASE
await mysql.connect()
const db = new QuickDB({ driver: mysql })
// ---> DATABASE
await mysql.connect()
const db = new QuickDB({ driver: mysql })
the error points to where I assign my db I'm using quickdb.js with promise-mysql project ID: ad4f96c1-5839-4882-89ea-53b1a95f4719
22 Replies
Percy
Percy•2y ago
Project ID: ad4f96c1-5839-4882-89ea-53b1a95f4719
Brody
Brody•2y ago
Are you using the correct environment variables?
Fragly
FraglyOP•2y ago
yes, I think so
const mysql = new MySQLDriver({
host: process.env.MYSQLHOST,
user: process.env.MYSQLUSER,
password: process.env.MYSQLPASSWORD,
database: process.env.MYSQLDATABASE,
});
const mysql = new MySQLDriver({
host: process.env.MYSQLHOST,
user: process.env.MYSQLUSER,
password: process.env.MYSQLPASSWORD,
database: process.env.MYSQLDATABASE,
});
Maybe I should store my data as a json in a discord message Troll
Brody
Brody•2y ago
Those are indeed the correct variables Let me do some testing
Fragly
FraglyOP•2y ago
Alright, thanks for your help Brody!
Brody
Brody•2y ago
if possible do you wanna provide me with a full code snippet? code that just connects to the db and would print a success message
Fragly
FraglyOP•2y ago
async function connectDB() {
// ---> DATABASE
const mysql = new MySQLDriver({
host: process.env.MYSQLHOST,
user: process.env.MYSQLUSER,
password: process.env.MYSQLPASSWORD,
database: process.env.MYSQLDATABASE,
});

await mysql.connect()
const db = new QuickDB({ driver: mysql })
}
connectDB().then(console.log("success")).catch(error => console.error(error))
async function connectDB() {
// ---> DATABASE
const mysql = new MySQLDriver({
host: process.env.MYSQLHOST,
user: process.env.MYSQLUSER,
password: process.env.MYSQLPASSWORD,
database: process.env.MYSQLDATABASE,
});

await mysql.connect()
const db = new QuickDB({ driver: mysql })
}
connectDB().then(console.log("success")).catch(error => console.error(error))
something like this?
Brody
Brody•2y ago
yep exactly specify a port in that config port: process.env.MYSQLPORT
Fragly
FraglyOP•2y ago
Alright "Client does not support authentication protocol requested by server; consider upgrading MySQL client"
Brody
Brody•2y ago
lol
Fragly
FraglyOP•2y ago
why
Fragly
FraglyOP•2y ago
yea, that's the package I'm using
Brody
Brody•2y ago
Fragly
FraglyOP•2y ago
wait wait, no, using quickdb.js https://quickdb.js.org/en/introduction/
Brody
Brody•2y ago
ah okay thats better i shall investigate
Fragly
FraglyOP•2y ago
thanks a ton 😭
Brody
Brody•2y ago
so while quick.db has been updated recently, the underlying mysql package hasn't, and doesn't support mysql v8
Fragly
FraglyOP•2y ago
Darn, okay thanks Brody! I guess I'll use a different aotDepressedMikasa appreciate your help!
Fragly
FraglyOP•2y ago
Alright, I'll check it out, thank you :D
Brody
Brody•2y ago
no problem!
Want results from more Discord servers?
Add your server