You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
md5file/Database/index.js

24 lines
899 B

const mysql = require('mysql2/promise');
async function initSQL() {
const connection = await mysql.createPool({
host: 'localhost',
user: 'root',
database: 'rgvofficial',
password: 'root',
waitForConnections: true, //连接超额是否等待
connectionLimit: 10, //一次创建的最大连接数
queueLimit: 0, //可以等待的连接的个数
maxIdle: 10, // max idle connections, the default value is the same as `connectionLimit`
idleTimeout: 60000, // idle connections timeout, in milliseconds, the default value 60000
});
connection.getConnection(function(err, conn) {
// Do something with the connection
conn.query(/* ... */);
// Don't forget to release the connection when finished!
pool.releaseConnection(conn);
})
global.SQL = connection
}
module.exports = initSQL;