Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to connect mysql using node js stack

var mysql = require('./node_modules/mysql');
    var connection = mysql.createConnection({
            host: '127.0.0.1',
            user: 'root',
            password: '',
            database: 'nodeapp'
        });
    connection.connect(function (err) {
        if (err)
            throw err;
    });
    module.exports = connection;
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #connect #mysql #node #js #stack
ADD COMMENT
Topic
Name
9+1 =