title: Multiple Statements in mysql2 - nodejs
body: <p>I'm using <a href="https://www.npmjs.com/package/mysql2" rel="nofollow noreferrer">mysql2</a> in my nodejs project, in <a href="https://www.npmjs.com/package/mysql" rel="nofollow noreferrer">mysql</a> library i used Multiple Statements for update my database and that works great, but for some reason in mysql2 it doesn't work, i googled it a lot and didn't found any solution, does mysql2 not support in multple statements??</p>
  
  <ul>
  <li><p>Here's the multiple query</p>
  
  <pre><code>async function updateChannels(dtz) {
  for (const data of dtz) {
    multipleQuery += `UPDATE myTable SET data='${data.newData}' WHERE data='${data.oldData}';`
  }
  await con.execute(multipleQuery);}
  </code></pre></li>
  </ul>
  
  <p>In mysql.createConnection i added  <strong>multipleStatements: true</strong></p>
  
  <ul>
  <li>Here's the error</li>
  </ul>
  
  <p>UnhandledPromiseRejectionWarning: 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 'UPDATE</p>
  
  <p><strong>That query working great when i copy and paste it in the phpMyAdmin console</strong></p>