Created
February 28, 2014 00:26
-
-
Save dac09/9262691 to your computer and use it in GitHub Desktop.
Node mysql table create and insert example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mysql = require('mysql'); | |
var connection = mysql.createConnection({ | |
host : 'localhost', | |
user : 'root', | |
password : 'mysql' | |
}); | |
connection.connect(); | |
connection.query('CREATE TABLE test.table1(Col1 VARCHAR(10), Col2 VARCHAR(50))', function(err, rows, fields) { | |
// connection.query('INSERT INTO test.table1 VALUES("blahblah", "blahblah2")', function(err, rows, fields) { | |
if (err) throw err; | |
// console.log('The solution is: ', rows[0].solution); | |
}); | |
connection.end(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment