A pure node.js JavaScript Client implementing the MySql protocol. This is about the node package `mysql`, not `node-mysql` which is much less popular.
Questions tagged [node-mysql]
699 questions
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
3
votes
2 answers
How to check if the db connection is success or not in node js and mysql
I'm using mysql connection pool to create connection. The code looks like the following.
var pool = mysql.createPool(connectionProps);
by accessing pool, I'll get the an Object, even if the connection is not Successful. I checked it with starting…

Demolition
- 138
- 1
- 1
- 10
3
votes
4 answers
Get yesterday date in SQL
i am try to request date only yesterday but without success...
My query request.
SELECT registeredDaySell FROM new_sell WHERE DATE_SUB(CURDATE(), INTERVAL 1 DAY)
My date is organized this way.
16 September, 2017
Thanks for helping me out.

Gabriel
- 237
- 1
- 7
- 19
3
votes
1 answer
nodejs mysql memory leak on large volume of high frequency queries
TL;DR
https://gist.github.com/anonymous/1e0faaa99b8bb4afe3749ff94e52c84f - Demonstrates memory consumption implying a leak. Is this in my code or in the mysql package?
Full version :
I am seeing lot of memory leak (and eventual crash every few…

brahmana
- 1,286
- 12
- 24
3
votes
0 answers
Node.js / MySQL queries extremely slow
I am running Node.js/MySQL with the following driver: https://github.com/mysqljs/mysql
The application works, but if I call the function more than 2-3 times a second the queries start executing extremely slowly, sometimes taking minutes to execute…

angularchobo
- 183
- 1
- 3
- 17
3
votes
2 answers
How to return a nested json in node.js mysql in a single query
I'm trying to create an api that will return a nested json, coming from two related tables student and studentSubjects
[{
id:"1",
name: "John",
subjects: [{
id:"1",
subject: "Math"
},
…

Dondon Abion
- 31
- 1
- 4
3
votes
2 answers
How to keep mysql connections alive in node.js?
I'm using mysql connection pools in Node JS. After some idle time, the connections expire and the next time I perform a query, a new connection needs to be created. This can cause a delay of several seconds. Unacceptable!
I would like to implement…

Megan D
- 379
- 3
- 13
3
votes
2 answers
How to use singleton design pattern with mysql connection and pooling in node.js
I'm using node-mysql as the orm. (https://github.com/mysqljs/mysql)
I'm creating a REST API using MySQL and Node.JS. Earlier I did the same using MongoDB. And it's working fine. github.com/chanakaDe/Mint-REST. Now I want to do the same using MySQL.…

Chanaka De Silva
- 401
- 9
- 20
3
votes
1 answer
When should one use connection pooling in node.js mysql?
This is the typical way I create MySQL connection in node.js
var connection = mysql.createConnection({
host : 'localhost',
user : 'root',
password : '',
database : 'address_book'
});
var app =…
user6064424
3
votes
1 answer
Nodejs MySQL datetime formatting
So I have a bit of a weird issue. As far as I know, node-mysql should format datetime to javascript date objects. However, it's not.
This is the column:
mysql> select order_time from jobs;
+---------------------+
| order_time …

yusijs
- 867
- 9
- 20
3
votes
1 answer
Sequelize is creating dangling/hanging mysql connections after getting SequelizeDatabaseError: ER_LOCK_DEADLOCK
I have an accounting system in which I try to create transactions at high concurrency (load testing). This results in getting error SequelizeDatabaseError: ER_LOCK_DEADLOCK: Deadlock found when trying to get lock; try restarting transaction from the…

vworld4u
- 89
- 1
- 5
3
votes
1 answer
bluebird node-mysql2 transaction
been trying to promisify node-mysql2 transaction, but can't get it to work, any pointers?
i've been through the docs at http://bluebirdjs.com/docs/api/disposer.html
i also have working version of non transaction related code, but getting…

Will Huang
- 31
- 4
3
votes
0 answers
Nodejs mysql - PROTOCOL_SEQUENCE_TIMEOUT - how to properly close a connection
I am trying to use the nodejs-mysql module from felixge. What I need to do is to make an one off query, get the result and end the connection.
As you can see bellow I set up my connection, query and on results I try to end the connection. Now the…

czioutas
- 1,032
- 2
- 11
- 37
3
votes
1 answer
Connecting to Amazon RDS database from heroku node app using node-mysql
I have
app.connectionPool = mysql.createPool({
host : * * *, //(a.k.a ....rds.amazonaws.com)
user : * * *,
password : * * *,
database : * * *,
ssl: 'Amazon RDS'
});
for initializing the db pool and it works…

sepans
- 1,372
- 13
- 24
3
votes
1 answer
How to selectively invoke middleware?
I have this menu on every page in my Node website:
I populate it on each request using some custom middleware:
app.use(function(req, res, next) {
// find the 9 most popular technologies to show in the 'technologies' menu
// drop-down. this…

Angular noob
- 437
- 4
- 11