Hanvod

MySQL connect() isnt working.

Recommended Posts

I am using the following code:

var SQL = require('mysql')
var c = SQL.createConnection({
  host: '*here was my ip*',
  user: '*here was my user*',
  password: '*here was my password*',
  database: '*here was my database*'
});
console.log("TESTTESTTEST");
c.connect(function(e) {
console.log(123);
if(e) {
	console.log("Error connecting to the database with error "+e);
}
else {
	console.log('Database connected!')
}
});
c.query("INSERT INTO Cars VALUES (5,5,5,5,123)")
c.query("SELECT * FROM Cars", (err, result) => {
	console.log(result);
});

and it doesnt work when I run it as a part of server package, but works well when I run it with Node.

rx52aLw.png

Please, help me.

Share this post


Link to post
Share on other sites

I have a simelar issue (not with connection but with some transaction calls) ... did you found a solution (so that I maybe have a point where I have to look?)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.