---
title: "node-mysql pool"
author: "maxer025"
date: "2016-07-15T17:37:13Z"
tags: []
categories: ["移动开发"]
slug: "node-mysql-pool"
draft: false
lastmod: "2016-07-15T17:37:13Z"
id: 2311530
url: "https://maxer025.iteye.com/blog/2311530"
---

var mysql = require('mysql');
var pool  = mysql.createPool(config);

pool.getConnection(function(err, connection) {
  // Use the connection
  connection.query( 'SELECT something FROM sometable', function(err, rows) {
    // And done with the connection.
    connection.end();

    // Don't use the connection here, it has been returned to the pool.
  });
});