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
0
votes
2 answers
node.js node-mysql query not working
When querying the DB, I get this error:
TypeError: Cannot call method 'query' of undefined
at Object. (/home/nodeuser/myapp_node/index.js:51:17)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js…

Dan P.
- 1,707
- 4
- 29
- 57
0
votes
2 answers
node-mysql dependant program runs only in the /node_modules/node-mysql folder
I have a node-mysql program
node db.js
module.js: 340
throw err;
Error: Cannot find module 'mysql'
the error is @
var mysql = require('mysql'); //for node-mysql
The error goes away and it all works when I run the program in the…

bezzoon
- 1,755
- 4
- 24
- 52
0
votes
1 answer
NodeJs-MySQL object property undefined
I don't know why I can't access my property.
connection.query("call VerifyAccountToken(0, null)", function(err, rows, fields) {
if(err) console.log("Error: " + err);
console.log("SQLRet: ", rows[0].result);
console.log(rows);
…

DeaconSyre
- 1
- 2
0
votes
2 answers
In nodejs with MySQL
I am Using Nodejs with MySQL.
But problem is that My MYSQL Connection Password Able to see in browser, With this any user get my my SQL username and Password.
Is it possible no one can see my MySQL Connection permanent as its is a server side.
Can…
0
votes
3 answers
When to initialize mysql connections in node
I'm trying to figure out what the best time to actually initialize connections for mysql in node is.
Am I supposed to create a pool of connections and then set them to some global so that all my models have access to the pool? Or am I supposed to…

Glem
- 449
- 6
- 16
0
votes
1 answer
How to connect to MySQL using node.js (with node-mysql driver)?
I have the following code, which I am trying to run. I have given comments accordingly to mention what all I have tried.
// File saved as app.js
var mysql = require('mysql');
var connection = mysql.createConnection({
host:'localhost', //even…

Amol M Kulkarni
- 21,143
- 34
- 120
- 164
0
votes
1 answer
SELECT @variable do not work in mysql?
var client = new require("mysql-pool").MySQLPool({...});
client.query(
"SET @counter := 0, @type := 'asd'; select @counter, @type" ,
function (error, result, fields) {
if (error) {
throw error;
}else{
…
0
votes
1 answer
node-mysql connection error for 2nd request
When I run my server.js which is like
...
var app = require('express')(), mysql = require('mysql');
var mysqlConn = mysql.createConnection(connParam);
var controllers = {mysql: require('./controller/mysql.js')(app, mysqlConn, null)};
...
and the…

Samuel0Paul
- 7
- 5
0
votes
2 answers
How to commit transaction after loop over asynchonous updates
I'm using node-mysql-queues to handle database transactions in my application.
for (lineitem in lineitems) {
transaction.query("SELECT n from inventory WHERE productId = ?", [lineitem], function (err, rows) {
if (err)
…

NorRen
- 711
- 2
- 9
- 22
0
votes
2 answers
how to join the result of two node-mysql.js functions in express.js
I'm trying to export some legacy data from a mysql db as JSON using express and node-mysql. The SQL below works fine. I'm struggling with a simple way to join the 'result' of getOwnerID and to the data for each row returned in compVouchers.
I'm also…

urfx
- 165
- 1
- 10
0
votes
1 answer
Handling strategy for (ER_QUERY_INTERRUPTED) on mysql
I'm writing an infrastructure library for our mysql servers.
One of scenarios I have to handle is a temporary disconnection from the mysql server.
The test scenario is start around 100000 inserts to the DB , and then stop the db and bring it…

Roman M
- 8,849
- 2
- 15
- 17
0
votes
1 answer
Node.js and global MySQL connection OBJ
I'm a beginner with Node.js, is it ever ok to use MySQL as a global var?
I have a db_helper.js with this code inside:
global.client = require('mysql').createConnection({
user: '__mysqluser__',
password: '__mysqlpass__',
database:…

Antonio Max
- 8,627
- 6
- 43
- 42
0
votes
1 answer
How do I return the results of .query in a class
I'm writing an application in NodeJS using coffee script and I need to store the results of a sql query made by a class into a variable that that class can return.
I have something like
class dataBase
mySQL = require('mysql');
connection =…

Working Title
- 254
- 7
- 28
0
votes
1 answer
Nodejs mysql module not connecting to database
I'm trying to do a simple test query to get the node mysql module working but it's not connecting to the database.
Here's my code in app.js:
var http = require('http'),
io = require('socket.io'),
sys = require('sys'),
express =…

Gavin Sellers
- 654
- 1
- 15
- 27
0
votes
1 answer
Querying multiple rows using node-mysql
This issue pertains to node-mysql.
I seem to be having a problem with the following code, and it seems to be related to the use of user defined variables. The rendered query runs fine inside of any mysql IDE, returning multiple records. However when…

clayperez
- 807
- 1
- 9
- 18