Questions tagged [node-mysql2]
131 questions
0
votes
1 answer
Gulp 4 task with node-mysql2 module causing server crash on connect
I have a need to run mysql queries within gulp to check certain fields in a table. I currently connect to a development server via ssh tunnel, which is opened via terminal so that my host is set to 'localhost'.
When I execute a connection attempt,…

Colin Knapp
- 65
- 7
0
votes
0 answers
Node.js node-mysql2 insert Buffer as Blob directly
What is the correct way to insert Buffer as BLOB just 1-to-1 without serializing to string/hex? Is it possible at all from Node.js?
At my backend I already have Buffers with binary data and want to store them with minimum overheads using prepared…

V.B.
- 6,236
- 1
- 33
- 56
0
votes
2 answers
NodeJS mysql query returning wrong result
I'm getting [ { 'AVG(Price)': '31000.0000' } ] instead of '31000.0000
this is the function
async function getAveragePrice(year) {
const sql = await init();
const [rows] = await sql.query('SELECT AVG(Price) FROM Car where year=
?', [year], (err,…

codingmonk
- 33
- 3
0
votes
1 answer
"mysql_clear_password" plugin error when using knex but not when using mysql2
I am trying to connect to MySQL server using the mysql_clear_password plugin. I set up the connection configuration for node-mysql2 as follows:
const connectionConfig = {
host: rwConfig.host,
user: rwConfig.user,
database: rwConfig.database,
…

KnexUser
- 11
- 2
0
votes
2 answers
Containerized server application failing to connect to MySQL databases
I'm trying to connect my server code running as a Docker container in our Kubernetes cluster (hosted on Google Container Engine) to a Google Cloud SQL managed MySQL 5.7 instance. The issue I'm running into is that every connection is being rejected…

moberemk
- 1,597
- 1
- 18
- 39
0
votes
2 answers
How to override how Dates are escaped?
I'm using node-mysql2. I want to override how JavaScript Date objects are escaped.
By default, they are converted to 'YYYY-mm-dd HH:ii:ss' strings, but I want to store them as integers instead.
How can I do this without reimplementing the entire…

mpen
- 272,448
- 266
- 850
- 1,236
-1
votes
1 answer
New relic couldn't find any database operations when using NestJS TypeORM and MySQL
I connected newrelic APM Agent for and I see all operations and logs except for mysql. On newrelic APM > app > Databases i see We couldn't find any Database operations. On Distibuted tracing I see Uninstrumented time on each DB operation.
How can I…

tagplus5
- 326
- 2
- 11
-1
votes
2 answers
NODEJS: The Response returned by the API is empty when the actual object is not
I have a handler to handle a specific route in nodejs with express.
async function handleGetAllBookingByUserId(req, res, next) {
try {
let bookings = await pool.execute(queries.getAllBookingByUserId, [
req.params.userId,
]);
let…

HighSha
- 23
- 5
-1
votes
1 answer
pool closed mysql2 discord bot
good day
When trying to add data to the database, it throws an error UnhandledPromiseRejectionWarning: Error: Pool is closed
It is necessary to upload the message id to the database
If there is another way to send mysql queries in order, I'm ready…

Dragwor
- 3
- 3
-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
-3
votes
2 answers
NodeJS - How to insert a blob image in MySQL
I have a list of int representing the hexa code or int8 of a picture, that I need to insert to MySQL as Blob. I am using a NodeJS Express server to do this, in an API. I am using the node packet node-mysql2, my NodeJS version is NodeJS 12.
So my API…

Martin S.
- 21
- 7