Socket
Socket
Sign inDemoInstall

mysql-import

Package Overview
Dependencies
33
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    mysql-import

import .sql files using NodeJS


Version published
Maintainers
1
Install size
1.56 MB
Created

Readme

Source

Hello....

This is a fork of the node package node-mysql-importer originally created by some European dude. I was using this as a dependency in another project and had a few issues. 1- it logged everything to the console, including my passwords and sensitive info and 2- if there're any semicolons in the datatabse all hell breaks loose. I left an issue on his repo and he promptly deleted (or hid) the repo, so I fixed and will maintain my own copy. Thanks for your work, Mark.

Install

$ npm install --save mysql-import

Introduction

This is a node module that allows you to load sql queries from a text file and run them against your MySQL database. It supports ECMA6 promises and requires a recent version of NodeJS 5+ to work.

Here is an example of usage. Note that each query in the text file must terminate with a semicolon followed by a newline or the end of the file(;).

const importer = require('mysql-import')

importer.config({
	'host': 'localhost',
	'user': 'testuser',
	'password': 'testpwd',
	'database': 'mydb'
})

importer.importSQL('mydb.sql').then( () => {
	console.log('all statements have been executed')
}).catch( err => {
	console.log(`error: ${err}`)
})

Keywords

FAQs

Last updated on 03 May 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc