How to create a table in MySQL using NodeJs - Web Development

How to create a table in MySQL using NodeJs

Now i will create a table in mysql (phpmyadmin) using nodejs code .First create write this code for details of db . I am using notepad++ you can use any code editor like sublime.

var mysql = require(‘mysql‘); Loading module .

Before executing this code you must download and install the mysql module.To access a mysql database with nodejs you need mysql driver.How to download mysql module: – Go to cmd and type npm install mysql. This line will download and install mysql on your local computer.

First load module mysql using the require function of node js. There are many modules in nodejs url , https, http ,realdline ,formidable etc and all the modules can be load using require function .

Now if you will check your db students table would have been created .

See our other tutorials

Leave a Reply

Your email address will not be published. Required fields are marked *