Cover by David Mark Clements

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

O'Reilly logo

Connecting and sending SQL to a MySQL server

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 LAMP (Linux Apache MySQL PHP) 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.

Getting ready

Let's grab mysql, which is a pure JavaScript (as opposed to C++ bound) MySQL client module.

npm install mysql

We'll ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required