Skip to content

Unable to connect Node with mysql #134

@sandeepjain2015

Description

@sandeepjain2015
var express =require('express');
var mysql =require('mysql');
var app =express();
var connection =mysql.createConnection({
    host:'localhost',
    user:'root',
    password:'',
    database:'piwikdemo'

});
connection.connect(function(error){
    if(error){
        console.log(error);
    }else{
        console.log('Connected');
    }
});

For other than 'test' and 'piwikdemo' script is showing following error
{ [Error: ER_BAD_DB_ERROR: Unknown database 'books']
code: 'ER_BAD_DB_ERROR',
errno: 1049,
sqlState: '42000',
fatal: true }

Please help

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions