NodeJs 不能同时执行多条Sql语句?

Winter

2018-10-26

同时执行多条语句会报错:Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select found_rows() as total' at line 1

第90篇《NodeJs 不能同时执行多条Sql语句?》来自Winter(https://github.com/aiyld/aiyld.github.io)的站点

1个回答
Winter 2018.10.26

由于Node mysql做了安全的限制,想要执行多条sql语句,需要打开对应开关配置


var mysql = require('mysql');
var pool  = mysql.createPool({port:"..", host, "...", ... , multipleStatements: true});

在配置中添加multipleStatements: true

问题类别

JavaScript Ckeditor Python Webpack TypeScript Vue.js React.js ExpressJS KoaJS CSS Node.js HTML Django 单元测试 PHP Asp.net jQuery Bootstrap IOS Android