Questions tagged [node-mysql]

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.

699 questions
6
votes
2 answers

Return rows with nodejs and node-mysql

I'm discovering Nodejs and the node-mysql module. I have a small problem. Every tutorial that I find explain how to do a select on the database but they never return the rows, they always log them, which is absolutely useless for my case. I have a…
c4k
  • 4,270
  • 4
  • 40
  • 65
6
votes
3 answers

What's the best Node.js mysql module for connecting to mysql over ssl?

I've built my app so far using node-mysql. I just set up a securely accessible mysql database using AWS RDS service and have tested an SSL connection successfully with the mysql command line client. I have Amazon's public key .pem file. node-mysql…
ABCD.ca
  • 2,365
  • 3
  • 32
  • 24
5
votes
1 answer

getServerSideProps and mysql (RowDataPacket)

I'd like to do server side rendering with Next.js using the getServerSideProps method like explained in the docs. The data should come from a database, so I'm using the mysql package. This results in the following error: Error serializing…
K. D.
  • 4,041
  • 9
  • 48
  • 72
5
votes
0 answers

Buffer - TypeError: Cannot read property 'from' of undefined

I use nodejs and react. I often get this error, sometimes this error message does not appear and sometimes also appears. Error return SafeBuffer.Buffer.from(json, 'utf8').toString('base64'); TypeError: Cannot read property 'from' of undefined I…
dev Faris
  • 113
  • 7
5
votes
2 answers

Node Mysql On Duplicate Key Update only updates unique row

I am using MySQL 5.7 with Node JS 6.11.0 and am trying to update a UNIQUE MySQL column whenever I insert a conflicting row. However, when I try inserting a conflicting record, only the existing record is updated to NULL and no insert happens. Here…
Dennis Wanyonyi
  • 368
  • 1
  • 5
  • 18
5
votes
3 answers

node.js mysql query in a for loop

I have two queries. The first, SELECT auctions.name, wowitemdata.itemName, auctions.itemId, auctions.buyout, auctions.quantity FROM auctions INNER JOIN wowitemdata ON auctions.itemId = wowitemdata.itemID; returns data like this: { name:…
Chris
  • 185
  • 1
  • 4
  • 13
5
votes
2 answers

node.js and mysql connection pool does not export

I am unable to export a pool connection in node.js. What I want is to get the connection from the pool from the db.js and use it and then release it after using it. db.js var mySQL = require('mysql'); var pool = mySQL.createPool({ host:…
JN_newbie
  • 5,492
  • 14
  • 59
  • 97
5
votes
1 answer

Node mysql TypeError: conn.beginTransaction is not a function

I have a mysql query I am trying to perform with node-mysql that uses a transaction. It should be on the connection object, but the error I am getting says that it doesn't have a begin transaction method. TypeError: conn.beginTransaction is not a…
realisation
  • 475
  • 6
  • 19
5
votes
1 answer

How do I map tags to tag synonyms?

I am building a system where users associate tags with posts, not unlike SO. I am having a spot of bother implementing tag synonyms. Here I have a table called Tags: | TagName | |------------| | Python | | JavaScript | | Node | And I…
Angular noob
  • 437
  • 4
  • 11
5
votes
3 answers

Correct UPDATE query syntax for node-mysql

I have an array 'flag' and I have changed the values of that array in my function. Now I need to update the same into the database, but I am unable to do so. I already have flag column in the table. I don't know how to update the value within the…
user3050590
  • 1,656
  • 4
  • 21
  • 40
5
votes
1 answer

node mysql inserting current date

mysql node docs give an example of how to escape and do neat things. I am unable to figure out how to insert the current time using this approach. var post = {id: 1, createdDate: 'NOW()'}; var query = connection.query('INSERT INTO posts SET ?',…
Kaya Toast
  • 5,267
  • 8
  • 35
  • 59
5
votes
2 answers

Expressjs response as JSON and Xml

What i am doing:: I am trying to generate json and xml output for a dataset from database Express Code:: Here i am trying for JSON response var express = require('express') , async = require('async') , http = require('http') , mysql =…
Devrath
  • 42,072
  • 54
  • 195
  • 297
5
votes
7 answers

Can't connect to localhost database from node.js server

Been having a lot of trouble trying to connect to to my localhost database. I've tried using the mysql and mysql-simple node modules but in both cases I just can't get it to connect. Here's what I used with the 'mysql' module: var mysql =…
Nikolai
  • 51
  • 1
  • 1
  • 4
5
votes
4 answers

Is there is any problems if we don't close the mysql connection in mysql node js module

If we don't close or end mysql connection in node js, is it effects in feature or not. I am doing like this var mysql = require('mysql'); var connection = mysql.createConnection(...); connection.query('SELECT 1', function(err, rows) { //…
web spider26
  • 252
  • 4
  • 16
4
votes
3 answers

node-mysql query attempts to replace my question marks with parameters against my will

I'm trying to run a simple query with node-mysql like this: client.query("UPDATE mytable SET emote='wtf?' WHERE id=5"); And I get the error Error: too few parameters given Because it found a question mark and expects parameters. How the heck do I…
Hubro
  • 56,214
  • 69
  • 228
  • 381