I am trying to use node.js for the creation of a MySql database and tables.
The query I want to execute is:
CREATE DATABASE NodeTest;USE NodeTest;CREATE TABLE tblUsers (userId varchar(32), userName varchar(255), friendlyUserName varchar(255));
So I concatenate the queries together. In MySqlWorkbench this is working just fine.
In my NodeJS project it says there is a syntax error in my SQL statement.
My node code:
mysqlConnection.query( 'CREATE DATABASE NodeTest;USE NodeTest;CREATE TABLE tblUsers (userId varchar(32), userName varchar(255), friendlyUserName varchar(255));' , function( oError ){
if ( oError ) throw oError;
console.log( 'Database created.' );
});
I am using node-mysql (https://github.com/felixge/node-mysql) for my mysql operations.
According to the docs it is possible concatenate queries.
Why is this not working?