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
2
votes
2 answers
ROLLBACK doesn't rollback transaction [NodeJS, MySQL]
connection.query(`START TRANSACTION;`, async function (err) {
if (err) {
req.flash("flash", "Something went wrong while deleting. Try again.");
return res.redirect("back");
} else {
await connection.query(
`INSERT INTO... ;…

Janez Kranjski
- 115
- 2
- 10
2
votes
1 answer
Storing mysql query rows in variable for later use in another mysql query
I have 2 different tables where the first table is used for retrieving the data to store in the second table, so for example, if there are 3 items in the first table, ill run a for loop 3 times to retrieve the information and storing it in the…

3dsss
- 37
- 2
- 12
2
votes
2 answers
Typeorm eager loading not working on one to one relationship
Can we eagerly load a one-to-one related entity in typeORM?
I am using TypeOrm in nestjs.
The two One-to_One related entities are driver and job:
in Driver Entity:
@OneToOne(() => JobEntity, job => job.current_driver)
@JoinColumn({ name:…

Hussain Wali
- 308
- 3
- 12
2
votes
0 answers
How can I get all inserted ids in mysql using node module in node.js?
I have table
users
id
name
1
One
2
two
I want to insert multiple data in this table with
const query = `INSERT INTO users (`name`) VALUES("three"), ("four")`;
now I used this with any npm module like:
const result = await…

Dhaval
- 868
- 12
- 22
2
votes
0 answers
MySql query optimised in console, but not optimised in Node/Python clients
I have a rather complex query, using many joins and a not in clause. I've tailored this query using the MySql console to be optimised, and I'm sure there is no DEPENDEND SUBQUERY in the execution plan. But, for my surprise, when I execute the exact…

gahag
- 93
- 1
- 4
2
votes
0 answers
Node Mysql Insert and Modify shorthand from object with 1 conversion
There is a very useful shorthand for Node Mysql where it automatically spreads all object values as column values like this:
'INSERT INTO `table` SET ? ;', [someobject]
or
'UPDATE `table` set ? WHERE id = ?',[someobject,id]
This is very handy as…

Vincent Duprez
- 3,772
- 8
- 36
- 76
2
votes
0 answers
I get net.createconnection is not a function using Browserify
I want to display some db query result on my website
Using browserify to include node modules on client side I get the error mentioned above and am stuck now:
This is my main.js
const mysql = require('promise-mysql')
async function run() {
…

tiedurden
- 21
- 3
2
votes
0 answers
MySQL query super slow when using nodejs/mysql2 but fast using other clients
I have the following query:
SELECT
`Job`.`id`,
`Job`.`serviceId`,
`Job`.`externalId`,
`Job`.`createdAt`,
`Job`.`updatedAt`,
`logs`.`id` AS `logs.id`,
`logs`.`statusId` AS `logs.statusId`,
`logs`.`createdAt` AS…

Philipp Kyeck
- 18,402
- 15
- 86
- 123
2
votes
1 answer
code: "PROTOCOL_ENQUEUE_AFTER_FATAL_ERROR" in nodeJs MySQL
I have this issue since I uploaded my code on hosting panel, my Database is different server and API is a different server
The error is code: "PROTOCOL_ENQUEUE_AFTER_FATAL_ERROR", fatal: false}
it is working for some time but after calling another…

K.S
- 443
- 10
- 29
2
votes
2 answers
How can I connect my ionic app to cpanel node server?
I'm developing an ionic app which has to be connect with cpanel node.js mysql server. when server runs in cpanel it shows as server is running. but I can't send requests from my app to the server. I'm confused with the server IP and port.
for node…

Prabhashi Buddhima
- 1,235
- 2
- 13
- 19
2
votes
0 answers
OneSignal-node Android doesn't receive additionnalData properties
Here's the thing. I want to send a push notification to an android device using OneSignal from a node.js server which takes data from a mysql database to send them as additionalData on the notification.
I use onesignal-node module to send the…

Buu97
- 158
- 2
- 15
2
votes
0 answers
Catching exception from event listener in express route
I am using nodejs, express and node-mysql2 for my application. I want timezone for each connection to use UTC so that my time_created and time_modified (MYSQL: On update CURRENT_TIMESTAMP) column will have timestamp in UTC only. I don't have…

AnSh
- 147
- 1
- 6
2
votes
0 answers
When does node-mysql return `fields` as part of a query result
According to the node-mysql documentation, the callback to a query will get three parameters - an error, the row(s) or result of the query, and something called fields which may or may not be passed everytime.
fields will contain information about…

elssar
- 5,651
- 7
- 46
- 71
2
votes
2 answers
Node.js, mysql and transaction with util(async/await)
How I can use transaction with node.js, mysql, util?
My connection is create by
var mysql = require("mysql");
var util = require("util");
var connection = mysql.createPool({
connectionLimit: 10000,
acquireTimeout:…

Paweł Baca
- 814
- 2
- 15
- 28
2
votes
0 answers
How to add an Alias to Query in Node-mysql
I can't find any note on this topic in the docs, I hope someone has a solution.
I'm trying to escape my queryparameters, but I can' add an alias without breaking the query.
What I want to achieve:
SELECT order.name as orderName, customer.name as…

CJay87
- 21
- 2