Structured Query Language has been a standard since 1986, and it's the prevailing language for relational databases. MySQL is the most popular SQL relational database server around, often appearing in the prevalent Linux Apache MySQL PHP (LAMP) stack.
If a relational database was conceptually relevant to our goals in a new project, or we were migrating a MySQL-backed project from another framework to Node, the third-party mysql
module would be particularly useful.
In this task, we will discover how to connect to a MySQL server with Node and execute SQL queries across the wire.
Let's grab mysql
, which is a pure JavaScript (as opposed to C++ bound) MySQL client module:
npm install [email protected]
We'll need a MySQLserverto connect to. By default, the mysql client module connects to localhost
, so we'll have MySQL
running locally