execsql
An npm project. Node.js Execute you *.sql file which contains multiple sql statements. Usate: init database.
Usage
As a CLI tool
-
Make sure that you have
execsql
installed globallynpm install -g execsql -
Configure your db access for the first time
execsql -c "localhost" "root" "root"
-
Execute a bunch of sql statements
execsql "use db_cam; delete from admin;" -
Execute a
.sql
fileexecsql -f ./db.sql
As a Node dependency
-
Make sure that you have
execsql
installed locallynpm install execsql -
Require and use
var execsql =dbConfig =host: 'localhost'user: 'root'password: 'root'sql = 'use db_cam;'sqlFile = __dirname + '/db.sql';execsql;