Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var mysql = require('mysql');
- var connection = mysql.createConnection({
- host: 'MY_HOST_IP',
- database: 'MY_HOST_DB',
- user: 'MY_HOST_USR',
- password: 'MY_PW'
- });
- connection.connect(function (err) {
- console.log('conecting');
- if (err) {
- console.error('Error connecting: ' + err.stack);
- }
- console.log('Connected as id ' + connection.threadId);
- });
- connection.query('SELECT * from accounts', function (error, results, fields) {
- if (error) console.log(error);
- console.log('account ', results[0]);
- });
- connection.ping(function (error) { console.log('pingerror'); });
Add Comment
Please, Sign In to add comment