Created
August 12, 2013 12:31
-
-
Save zhuangya/6210437 to your computer and use it in GitHub Desktop.
This file contains hidden or 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: 'vimscripts', | |
| password: 'vimscripts', | |
| database: 'vimscripts' | |
| }); | |
| connection.connect(function(err) { | |
| if(err) throw err | |
| console.log('connected'); | |
| }); | |
| connection.query('SELECT 1 + 1 AS solution', | |
| function(err, rows, fields) { | |
| if(err) throw err; | |
| console.log('The solution is: ', rows[0].solution); | |
| }); | |
| console.log('job\'s done'); | |
| connection.end(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment