Questions tagged [node-mysql2]

131 questions
1
vote
2 answers

TypeORM throws an error after insert with the queryBuilder in Nest.js

I have an entity and service defined as follows. user.entity.js @Entity({ name: 'users' }) export class User { @Column({ type: 'binary', length: 16, select: false, primary: true, default: () => `(UUID_TO_BIN(UUID(), 1))`, …
Mnengwa
  • 217
  • 4
  • 10
1
vote
0 answers

MySQL JSON column parsed on Linux but not Windows

There exists a database with a users table containing 2 columns, userId and saved. userId is a simple increment, and saved is JSON data. There exists a single row: userId: 1, saved: "{"value": 1}" When the following code is run on Windows const…
bluewave41
  • 135
  • 2
  • 13
1
vote
1 answer

MySQL stored procedure vs Node.js performance

I have an API with Express/Node.js with MySQL DB. I'm using the Mysql2 npm package (no ORM) for queries. For some particular routes, I have some queries running in parallel (which are not exactly related, so no joins can be performed). I want to…
VaibhavJoshi
  • 355
  • 2
  • 15
1
vote
1 answer

correctly handle async/await on a mysql query

I am trying to perform a mysql query asyncronously assigning a value to a const to be later used in my code. What I have so far is: const plan_free = await con1.promise().query("SELECT stripe_price1 FROM funzioni WHERE titolo='SmartBanca'") .then(…
Lelio Faieta
  • 6,457
  • 7
  • 40
  • 74
1
vote
1 answer

nodejs v6.11.2 ssl connection using mysql2 utility using pool connection

we are using node v6.11.2 and pooling connection using mysql2 utility/module Below is the snippet . const mysql = require('mysql2'); const cpmPoolConfig = { connectionLimit: config.get('mysql_cpm.connectionLimit'), host:…
shekhar
  • 21
  • 1
1
vote
1 answer

mysql does not accept "?" as bind operator

Trying to run a query to update a database, and for some reason, MySQL returns: Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line…
vrghost
  • 1,084
  • 2
  • 19
  • 42
1
vote
1 answer

Does Mysql2 for Node.Js require running connect() on mysql.CreateConnection before executing queires

I recently migrated a node.js project from mysqljs to mysql2 (https://www.npmjs.com/package/mysql2) because it had some additional feature that I need. For my database calls, I am exporting a connection that was created by running…
Bneac
  • 69
  • 1
  • 10
1
vote
0 answers

Mysql auth issues client and server side

Im trying to connect to a mysql 5.0.95 database via node-mysql2, but according to node-mysql its a bad handshake, and according to node-mysql2 it is : "Error: Server requests authentication using unknown plugin . See TODO: add plugins doco here…
polar
  • 524
  • 5
  • 24
1
vote
2 answers

Can connect to remote mysql DB through mysql workbench but not through mysql2 (NodeJS)

I'm trying to connect my NodeJS application to my remote MySQL Database, but it keeps giving me a 1045 error ('ER_ACCESS_DENIED_ERROR'). From the same workstation, I can connect to the same database through MySQL Workbench perfectly fine. This…
Loerpert
  • 23
  • 7
1
vote
1 answer

node-mysql2: resultset not reflecting the latest results

I'm using node-mysql2 with a connection pool and a connection limit of 10. When I restart the application, the results are good - they match what I have on the db. But when I start inserting new records and redo the same select queries, then I get…
1
vote
1 answer

Sequelize create row even if the pass data has non existing field/column

I am creating a test for my models, now my scenario is I want to insert to a table with a column/field that is not defined on my Sequelize schema. Here is my sample for my schema class ResploginSchema extends Sequelize.Model {…
Oli Soproni B.
  • 2,774
  • 3
  • 22
  • 47
1
vote
1 answer

Overlapping in NodeJS/mysql2

When i joining 2 tables i have to get result as nested array how can i do it in nodejs with mysql2 if i am executing SELECT users.id as user_id , users.name as user_name , comments.id as comment_id , comments.comment as comment FROM users LEFT JOIN…
1
vote
0 answers

How do i over lapping columns as nested array ? NodeJS/MySQL (mysql2)

Actually, I'm trying to get my mysql result as nested array data i tried to many times with that main.js code got from github node-mysql-nesting. Thinking about ? why i need to use that function to convert those query result as nested array anyone…
1
vote
1 answer

How to handle error of closed MySQL connection in Node.js?

I've built a Node.js API that connects to a MySQL database. I use node-mysql2 as driver. The API and the database run in separate Docker container. At some point after deployment in a Kubernetes cluster I get the following error: Error: Can't add…
jengeb
  • 393
  • 1
  • 7
  • 21
1
vote
1 answer

Need data from promise in chain

I have a promise for getting data from a mysql database using mysql2 on express. I need to get data from the first query into the final returned object after running another query. db.query("SELECT * FROM users_tasks_link WHERE uin = ?",…
Dom Needham
  • 69
  • 1
  • 14
1 2 3
8 9