Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 633
Kaushik Das Avatar asked Jul 14 '15 04:07

Kaushik Das


People also ask

Can I use node js with XAMPP?

Run command : node -v and npm -v it gives node version ,If it shows then you installed the node successfully. Now Install Xampp (If not installed )download. html, and run Apache , If no error on, then we are almost done.

How connect MySQL to XAMPP?

Create MySQL Database at the LocalhostOpen your browser and go to localhost/PHPMyAdmin or click “Admin” in XAMPP UI. Now click Edit privileges and go to Change Admin password, type your password there and save it. Remember this password as it will be used to connect to your Database.

How connect PHP to MySQL database in WAMP server?

In your WAMP Server home page PhpMyAdmin link appears. Click that link and the database connectivity form will open in the following format. After the page opens in your right side window, click database and choose to create database. Choose your database and create table or you have to restore your SQL database.


1 Answers

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

like image 85
wuno Avatar answered Oct 12 '22 16:10

wuno