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
0
votes
0 answers

Why does my client only receive data from node.js after a client page refresh?

This is very odd. Here is the abridged output of my log: info - socket.io started debug - served static content /socket.io.js debug - client authorized info - handshake authorized D7J-52pdfYAtijFhFxh7 debug - setting request GET…
EvilJordan
  • 669
  • 7
  • 16
0
votes
1 answer

Queries are not executed after transaction is rolled back

I want to execute transactions in node-mysql (by executing queries START TRANSACTION, ROLLBACK, COMMIT). I have this piece of code: conn.query("START TRANSACTION"); conn.query("INSERT INTO users (id, name, age) VALUES (1, 'Mat', '24')",…
0
votes
2 answers

node.js - How to extend mysql results object

I am a long time PHP developer who decided to give node.js and express a try today. I am trying to find the best way to merge my results into a single object. I may be approaching this to much like a PHP developer and could use some assistance. …
0
votes
1 answer

Can't seem to query specific things using node-mysql with JavaScript

p_info_query('SELECT * FROM ' + + ' WHERE name = ' + user_name, password, client_connect.id, p_info, function(results) { This seems to produce a Unknown Column 'user_name'. I searched online for some examples of people doing this, but I…
user1328762
  • 129
  • 1
  • 2
  • 10
0
votes
1 answer

JS node-mysql bools acting weird

I have this function that I need to return true or false. Problem is, it doesn't seem to behave correctly. If it does return false, it doesn't disconnect the client, and if it does return true, it still does "console.log('Disconnecting…
user1328762
  • 129
  • 1
  • 2
  • 10
-1
votes
1 answer

uri format connection gets access-denied in mysql

I'm using Node and MySQL2 import mysql2 from 'mysql2' Following successfully creates connection: const connection = mysql2.createConnection({ host: 'localhost', user: 'root', password: 'My@Password', database:…
helloworld
  • 2,179
  • 3
  • 24
  • 39
-1
votes
1 answer

How to run MySQL multiple queries concurrently without waiting the result?

function dbQuery(sql) { dbcon.query(sql, function(err, result) { //imagine the PING to DB server is 1 second. //It would take 100 seconds to complete 100 Queries, if the query is run 1 by 1. }); } for (var i=0; i<100; i++)…
neobie
  • 2,847
  • 5
  • 27
  • 31
-1
votes
1 answer

Node.js postman infinite request time(*no errors and database is updated fine) on PUT request

I've been stuck on this for way too long without being able to find where is my error, I am making an API with node.js through express and all Restful functions work fine for me except the updating which gets stuck on postman "sending request" while…
-1
votes
1 answer

Error in your SQL syntax: SET Syntax (Lambda function)

While on the Lambda function, I'm trying to run the following query, but it throws an ER_PARSE_ERROR error. { "errorType": "Error", "errorMessage": "ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your…
-1
votes
1 answer

Using MySQL functions with Node mysql2 library

This is my current request to insert data: let record = { ip : '127.0.0.1', ... }; conn.query('INSERT INTO events_log SET ?', [record]); Is it possible to apply INET6_ATON function to the IP without converting it to a plain query? There are…
Eugene
  • 905
  • 1
  • 10
  • 22
-1
votes
1 answer

I am learning MYSQL and what am i doing wrong in this code

I have tried to execute the code below and I get an error message var mysql = require('mysql'); var con = mysql.createConnection({ host: "localhost", user: "root", password: "HewRld.8618", }); connection.connect(function(err) { if…
JoshNomso
  • 1
  • 2
-1
votes
1 answer

node-mysql returns column names instead of values

I have a mysql query like this: 'SELECT ? FROM tablename' with an args array like this: ['id']. When I call db.query(sql, args) the result is an array with ['id', 'id', 'id'] for every row in the database table instead of having the values from the…
Kilian
  • 51
  • 6
-1
votes
1 answer

Node mysql async await issue while using transaction

I am writing mysql query with transaction but its not waiting to be completed and returns the result even before the function has executed. Can someone please help me to know how to make function to wait for response? The calling function is…
D555
  • 1,704
  • 6
  • 26
  • 48
-1
votes
1 answer

Suggestions for NodeJS+MySQL

I'm new here so excuse me if my question is too general or simple. Recently, a basic web project was assigned as part of a course, and I'll be using NodeJS+MySQL (and VS Code which seems quite nice), but I have no experience with these 2 at all, so…
-1
votes
1 answer

How can I get comments for a discussion

My goal is to get the following query result: "Discussion": { "DiscussionID": 1, "Name": "Some Name", "Body": "Some Body", "Comments": [ { "CommentID": 1, "Body: "Some Body } ] } I have 2 Tables: Discussions and…
crispychicken
  • 2,592
  • 2
  • 33
  • 50
1 2 3
46
47