Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var mysql = require('mysql');
- var pool = mysql.createPool({
- connectionLimit: 5,
- host: 'localhost',
- user: 'root',
- password: '',
- database: 'todoapp'
- });
- pool.getConnection(function (err, connection) {
- if(err){
- console.log("error connecting: " + err.message);
- return;
- }
- console.log(connection);
- // Use the connection
- connection.query('SELECT * FROM myguests', function (err, rows) {
- if (err) console.log("error query: " + err.message);
- console.log(rows)
- // And done with the connection.
- connection.release();
- // Don't use the connection here, it has been returned to the pool.
- });
- });
Add Comment
Please, Sign In to add comment