Mysql2 Promapper包装器:从哪里获取错误以等待createConnection?

问题描述

这是相同的代码,但是如果数据库服务器关闭,createConnection的错误在哪里?

  const c = await MysqL.createConnection({
    port: 3306,user: 'testuser',namedplaceholders: true,password: 'testpassword'
  });
  console.log('connected!');
  const [rows,fields] = await c.query('show databases');
  console.log(rows);

该示例确实显示查询的尝试/捕获,但未创建连接 https://github.com/sidorares/node-mysql2/blob/master/examples/promise-co-await/await.js

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)