In this post we are going to explain how to connect a Node.js application to a MySQL server using the new MySQL Connector/Node.js; needless to say that we will be using the MySQL server as a document store.
There are two types of session that a connection can provide:
XSession and NodeSession.
An XSession encapsulates access to a single MySQL server running
the X Plugin or
multiple MySQL Cluster nodes; and the NodeSession serves as an
abstraction for a physical connection to exactly one MySQL server
running the X Plugin. To enable the XPlugin in the MySQL server
using the MySQL Client command line you need to use the root
account or an account with INSERT privilege to mysql.plugin
table:
- Invoke the MySQL command-line client: mysql -u user –p
- Run the following command: INSTALL PLUGIN mysqlx SONAME …