Questions tagged [mysqljs]
62 questions
9
votes
6 answers
node.js mysql pool connection with async/ await
Is there a way to use pool.getConnection() taken from the mysqljs/mysql lib with the async/ await syntax?
The idea is to have a method which returns one connection which can be passed around amongst write queries with various foreign key constraints…

Schmalitz
- 420
- 1
- 8
- 16
5
votes
1 answer
Correct way to implement single DB pool throughout express app
Note: This problem is mainly about singleton objects in node and not DB pools
I'm building an expressjs app using mysqljs node module for DB connections. I want to create a single pool object that can be reused throughout the app (for the different…

Nick
- 53
- 4
4
votes
1 answer
Node + Mysql: How to execute more queries based on another query
I'm pretty new to the node world and trying to migrate our php application to node. To be able to return all article data several different queries have to be done depending on the results of the first query. Currently my data object is empty as…

Menelik
- 99
- 2
- 8
3
votes
2 answers
Node Mysql Escaping - Mysql.Escape() / Mysql.EscapeId()
I am using mysql-node: https://github.com/mysqljs/mysql but I am a little confused about default sanitization, Mysql.Escape() vs Mysql.EscapeId() and the use of ? vs ??. The docs says?
Default Sanitization
When you pass an Object to .escape() or…

Yasin Yaqoobi
- 1,888
- 3
- 27
- 38
2
votes
1 answer
How can I debug queries sent via mysql2?
From the mysql2 readme we read :
MySQL2 is mostly API compatible with
mysqljs
Which package has an option defined as :
debug: Prints protocol details to stdout. Can be true/false or an array of packet type names that should be printed. (Default:…

Yanick Rochon
- 51,409
- 25
- 133
- 214
2
votes
1 answer
nodejs mysql insert null datetime field
using mysql-ssh
How to insert DateTime field's value to null in MySQL through nodejs?
Tried following:
connection.query('INSERT INTO idea_steps (field1, field2) VALUES(?, ?)', ['value1', null])
connection.query('INSERT INTO idea_steps (field1,…

Himanshu Bansal
- 2,003
- 1
- 23
- 46
2
votes
2 answers
How to create dynamic insert statement on the basis of POST body
The number of properties in body object is different which is based on a value user_type.
If the user_type is job_seeker then the body object is having these properties --> username, user_type, name, email, password, resume, resume_date_time,…

Germa Vinsmoke
- 3,541
- 4
- 24
- 34
2
votes
1 answer
Connect Sequelize without a password to MySQL?
Currently I am trying different ORMs, and in between Sequelize.
I have an application in development that does not have any password for the root user, but this is for development, is it mandatory to add a password to the configuration to connect…

juan garcia
- 1,326
- 2
- 23
- 56
2
votes
1 answer
Nodejs Mysql lib error "Too many connections"
Libary that I use: mysqljs/mysql
I have 250 max connections limit on mysql server, but my application sometimes get "Too many connections".
When I checked, mysql server only have 3 connections using show full processlist; command
Am I doing…

Lollorcaust
- 23
- 1
- 5
2
votes
1 answer
Webpacking a NodeJS Express API with MySQL throws connection error in mode '-p', not in '-d'
I have a simple Express API where I use MySQL to retrieve my data. I use Webpack 4 to bundle it with a very simple configuration:
'use strict';
const path = require('path');
module.exports = {
entry: './src/main.js',
target: 'node',
…

FreekM
- 21
- 4
2
votes
1 answer
how to escape string but not affect LIKE result in nodejs mysql js
Recently I am using mysqljs in nodejs web app.
I would like to escape all my parameters in SQL to prevent injection attack.
However in the LIKE schema, the SQL would be affected by the escape string sign `
Here is my query
SELECT event.name,…

鄭元傑
- 1,417
- 1
- 15
- 30
1
vote
0 answers
How can I retrive UUID from MySQL in my Flutter app?
I have a mysql table like this:
CREATE TABLE IF NOT EXISTS auth (
id BINARY(16) PRIMARY KEY);
And create a binary UUID like following within my NodeJS application:
user_id = id:
Then use…

best_of_man
- 643
- 2
- 15
1
vote
1 answer
MySQL throwing "execute command denied to user" when running stored procedure remotely
I have a nodejs service which is trying to run a stored procedure on a mysql database but the call fails with execute command denied to user.
The same service can successfully execute simple SELECTs and return data with no problems.
If I connect to…

Jonathan Smith
- 2,390
- 1
- 34
- 60
1
vote
0 answers
Query running in the workbench being much faster than in nodejs
I'm running the same query (in the same database) on nodejs (npm/package/mysql) and mysql workbench and the execution time is absurdly different.
Follows the execution duration data:
nodejs: 22468.275ms (22,5 seconds)
mysql workbench: duration…

Victor Guedes
- 55
- 9
1
vote
1 answer
Join Table from two different DB in Nodejs
I want to do joins on the table from two DBS.
What I did is.
var mysql = require('mysql');
var poolCluster = mysql.createPoolCluster();
var configDB=require('../config');
let…

Nitish Kumar
- 45
- 5