I've just started getting into Node.js. I come from a PHP background, so I'm fairly used to using MySQL for all my database needs.
How can I use MySQL with Node.js?
Check out the node.js module list
node-mysql looks simple enough:
Queries:
|
|||||||||||||||||||||
|
node-mysql is probably one of the best modules out there used for working with MySQL database which is actively maintained and well documented. |
|||
|
Since this is an old thread just adding an update: To install the MySQL node.js driver:If you run just For global installation:
For local installation:1- Add it to your
2- run Note that for connections to happen you will also need to be running the mysql server (which is node independent) To install MySQL server:There are a bunch of tutorials out there that explain this, and it is a bit dependent on operative system. Just go to google and search for |
|||
|
Here is production code which may help you. Package.json
Here is Server file.
Reference : https://codeforgeek.com/2015/01/nodejs-mysql-tutorial/ |
|||
|
Create table
|
||||
|
You can also try out a newer effort known as Node.js DB that aims to provide a common framework for several database engines. It is built with C++ so performance is guaranteed. Specifically you could use its db-mysql driver for Node.js MySQL support. |
|||||||||||||||||
|
connect the mysql database by installing a library. here, picked the stable and easy to use node-mysql module.
|
|||||||||||||
|
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
multipleStatements
function. – crawf Nov 16 '12 at 0:35