'localhost', user : 'root', password : '', socketPath : '/opt/local/var/run/mysql55/mysqld.sock' }); connection.connect(); var query = connection.query('SELECT * FROM sakila.actor'); query .on('result', function(row) { connection.pause(); function processRow(row, callback) { console.log(row); callback(); } processRow(row, function() { connection.resume(); }); }) .on('end', function() { console.log('end\n'); });