I'm trying to make a forum with a mariadb database on my raspberry pi (the nodejs server is on my computer and the database is on my raspberry) I can't connect to my raspberry pi with a user...
i get this error :
SqlError: (conn=-1, no: 45028, SQLState: HY000) retrieve connection from pool timeout after 10015ms
at Object.module.exports.createError (C:\Users\Josselin Arnaud\Desktop\forum\node_modules\mariadb\lib\misc\errors.js:56:10)
at Pool._requestTimeoutHandler (C:\Users\Josselin Arnaud\Desktop\forum\node_modules\mariadb\lib\pool.js:332:18)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7) {
text: 'retrieve connection from pool timeout after 10015ms',
sql: null,
fatal: false,
errno: 45028,
sqlState: 'HY000',
code: 'ER_GET_CONNECTION_TIMEOUT'
}
and here is my code :
const pool = mariadb.createPool({
host: '192.168.0.45',
user:'root',
password: '*hello*',
connectionLimit: 5
});
pool.getConnection()
.then(conn => {
conn.query("SELECT * FROM forum.utilisateur")
.then((rows) => {
console.log(rows); //[ {val: 1}, meta: ... ]
//Table must have been created before
// " CREATE TABLE myTable (id int, val varchar(255)) "
return conn.query("INSERT INTO forum.utilisateur value (?, ?)", [1, "mariadb", "mariadb", "mariadb", "mariadb"]);
})
.then((res) => {
console.log(res); // { affectedRows: 1, insertId: 1, warningStatus: 0 }
conn.end();
})
.catch(err => {
//handle error
console.log(err);
conn.end();
})
}).catch(err => {
//not connected
console.log(err);
});