How to get my MariaDB database details into my node application?
// config/connection.js
module.exports = {
host: ‘your-mariadb-host’, // e.g., ‘localhost’ or an IP address
user: ‘your-mariadb-username’, // e.g., ‘root’
password: ‘your-mariadb-password’, // e.g., ‘password’
database: ‘your-mariadb-database’, // e.g., ‘frappe_database’
port: 3306 // default MariaDB port
};
I’m Getthing This Error while running the server
node index.js
Server is running on port 8000
Error connecting to the database: Error: connect ETIMEDOUT
at Connection._handleConnectTimeout (C:\Users\Admin\Desktop\Backend\node_modules\mysql\lib\Connection.js:409:13)
at Object.onceWrapper (node:events:633:28)
at Socket.emit (node:events:519:28)
at Socket._onTimeout (node:net:590:8)
at listOnTimeout (node:internal/timers:573:17)
at process.processTimers (node:internal/timers:514:7)
--------------------
at Protocol._enqueue (C:\Users\Admin\Desktop\Backend\node_modules\mysql\lib\protocol\Protocol.js:144:48)
at Protocol.handshake (C:\Users\Admin\Desktop\Backend\node_modules\mysql\lib\protocol\Protocol.js:51:23)
at Connection.connect (C:\Users\Admin\Desktop\Backend\node_modules\mysql\lib\Connection.js:116:18)
at Object. (C:\Users\Admin\Desktop\Backend\index.js:87:5)
at Module._compile (node:internal/modules/cjs/loader:1358:14)
at Module._extensions…js (node:internal/modules/cjs/loader:1416:10)
at Module.load (node:internal/modules/cjs/loader:1208:32)
at Module._load (node:internal/modules/cjs/loader:1024:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
at node:internal/main/run_main_module:28:49 {
errorno: ‘ETIMEDOUT’,
code: ‘ETIMEDOUT’,
syscall: ‘connect’,
fatal: true