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
1 answer
Call object inside RowDataPacket using Node.js and MySQL
The code its about:
con.query(`SET @row_num = 0; SELECT @row_num := @row_num + 1 AS row_number, userid, username, lvl FROM users ORDER BY lvl + 0 DESC`, async (err, rowss) => {
if(err) throw err;
console.log(rowss[0].userid);
…

Syber
- 363
- 2
- 5
- 18
2
votes
1 answer
How to use one Mysql pool connection in many files in a NodeJS Express App
I've been scratching my head at this. I wanted to know if there was an efficient way of creating one Mysql connection and sharing it between different modules in an application served by Express. So far I have the following code at the top in all my…

realnsleo
- 709
- 2
- 12
- 29
2
votes
1 answer
Angular electron mysql create conncetion is not a function
I haveinstalled node js mysql and mysql types via
"@types/mysql": "^2.15.4",
"mysql": "^2.15.0"
Am using electron with angular2 so in my component i wanted to create a conncection via
import * as mysql from 'mysql'
@Component({
selector:…

Geoff
- 6,277
- 23
- 87
- 197
2
votes
3 answers
Use mysql with promises in node.js
I just followed the tutorial for authentication on node from scotch.io.
They used mongodb as a backend, and I ported this to mysql. This is my first node app connecting to a database.
I used bluebird to promisify the mysqljs/mysql package in…

Lorenz Meyer
- 19,166
- 22
- 75
- 121
2
votes
1 answer
JS basic design when I have naturaly sync code but I need to call a few async functions
Could you please help me to understand javascirpt async hell?
I think I am missing something important ☹ The thing is that js examples and most of the answers on the internet are related to just one part of code – a small snippet. But applications…

AZOR1984
- 23
- 3
2
votes
0 answers
node mysql's connection pool query callbacks are never called
Has anyone run into an issue with mysql where pooled query callbacks are never called?
I’m creating a pool and then using it to execute multiple queries like this:
const mysql = require('mysql')
const config = {
mysql: {host: ..., user: ...,…

Chris Schmitz
- 20,160
- 30
- 81
- 137
2
votes
2 answers
Store JSON using mysql module for Nodejs
I need to store a JSON in the column 'data' of this table:
I tried to store a json but I receive errors, probably due to for quoting...
connection.connect();
var query = 'INSERT INTO Forecasts (data, createdAt, updatedAt, OrchardId) VALUES…

gio
- 801
- 3
- 15
- 27
2
votes
1 answer
Node.js server not returning response after certain requests
Recently I developed a rest api using nodejs, express , https and mysql to the production. This working good in start but after two to three days I started to get complains that server is not responding and requests returning time out most of the…

user3528954
- 867
- 3
- 10
- 17
2
votes
1 answer
Connecting to MariaDB with nodejs over ssl with clear text password
I am trying to connect to mariadb instance over ssl,
var mysql = require('mysql');
var conn = mysql.createConnection({
user: 'user',
password: 'password',
debug: true,
port: '3306',
host: "host",
ssl: {
"ca": ca
…

Shashi Mishra
- 105
- 2
- 9
2
votes
1 answer
node-mysql transaction is not rolling back after unique key violation
I'm testing node-mysql transactions in my application by performing an INSERT that will violate a UNIQUE key constraint, after first performing an UPDATE. While the INSERT fails, I find that the initial UPDATE is succeeding, despite the transaction…

littleK
- 19,521
- 30
- 128
- 188
2
votes
1 answer
Node-Mysql Transaction rollback not working
js as well as mysql. I'm in trouble with transactions.
In the function below i did exactly as they said here https://github.com/mysqljs/mysql#transactions. But its not working :|
function insertMemoTransaction(){
…

mjuiok mjuiok
- 21
- 3
2
votes
1 answer
Prevent node.js process from dying on MySQL query error
I have a node.js script that runs a MySQL query. When error is encountered with this query, the node.js process dies. It uses the mysql-node module.
https://github.com/mysqljs/mysql
Here is my code;
function runQuery() {
return new…
user6064424
2
votes
1 answer
Node.Js - no output from mysql connection
Sorry in advance - using nodejs for the first time..
I have installed nodejs and npm manager on linux machine. Through the npm I installed mysql module and now I try to test the mysql connection using the simple code. The problem is - no output is…

Alex
- 4,607
- 9
- 61
- 99
2
votes
2 answers
When you call `release` instead `destroy` on connection?
I am asking about https://github.com/mysqljs/mysql . I am a bit puzzled what is the difference between destroy and release in practice. Consider such code:
pool.getConnection(function(err, conn)
{
if (err)
throw err;
…

greenoldman
- 16,895
- 26
- 119
- 185
2
votes
1 answer
NodeJS Async with mysql is confusing me
I am new to NodeJS. I have the following snippet.
var connection = mysql.createConnection(dbConfig);
connection.connect(function(err) {
if (err)
console.log("MySQL Connection Error: ", err);
else
console.log("Connection…

Hurricane Development
- 2,449
- 1
- 19
- 40