How to connect node.js to mysql and wamp/xampp server?

22,211

Solution 1

Follow this tutorial. Tutorial Here

To use node.js you need to install the packet manager NPM and use it to install the dependencies of your project.

In the example tutorial I posted above hes uses NPM to install all his dependencies to connect to mysql just as you requested. He also provides sample code.

Good luck!

Here is another few tutorials you might follow, Click Here

This uses mongoDB instead of mysql but following this tut will help you get things running quicker then you can find something to help with mySQL.

Click Here

After installing npm with the tutorial right above here and you check and make sure you have npm installed then follow this youtube tutorial to get mysql set up with node. And here is a youtube video. Click Here

Solution 2

It might help to use this package Node Mysql Package. Also you can find the resources in the answer to this question here.

Share:
22,211
Kaushik Das
Author by

Kaushik Das

Javascript, Python learner MongoDB C100DEV Certified professional Associate Level MS Azure (AZ-900 & AZ-204)

Updated on July 16, 2020

Comments

  • Kaushik Das
    Kaushik Das almost 4 years

    I'm a PHP programmer and currently working with WP, CI, OC.

    I am absolute beginner of node.js, want to know how to connect MySql and WAMP/XAMPP in step by step method.

    If I am going to live it, then what will be the live server setup.

    Please let me know in step by step method.