Node.js tutorial- dropping mysql table

Posted by

The tutorial provides the node.js integration with MySQL for dropping the database tables. The tutorial provides the steps on how to drop tables in mysql database using node.js application .

Drop MySQL Table using node.js

The MySQL uses ‘DROP TABLE’ statement for dropping the tables in mySQL database. Ensure that you have the mysql table created for which drop table command is to be executed using the node.js application.

var mysql = require('mysql');  
var con = mysql.createConnection({  
  host: "localhost",  
  user: "root",  
  password: ""  ,
  database: "oracleappshelpDB"
con.connect(function(err) {
  if (err) throw err;
  console.log("MySQL Database oracleappshelpDB is Connected successfully!");
  var sql = "DROP TABLE oracleappshelpUsers";
  con.query(sql, function (err, result) {
    if (err) throw err;
    console.log("Table oracleappshelpUsers is Dropped successfully from  the Database - oracleappshelpDB");