Jump to content

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*'
c.connect(function(e) {
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) => {

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


Please, help me.

Link to comment
Share on other sites

  • 6 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...