If you run into troubles, got a suggestion, or issue, please e-mail editor@webtigerteam.com

Databases

Databases are useful for persistently storing structured (and relational) data.

The cloud editor has built in support for mySQL databases.

Creating a database

In the menu, click "Database manager", and then click Create new database.
You then get a dialog box where you type the name of the database.

Connecting to a database from a Node.JS script

Use the mysql2 Node.JS module. See example code below:

No password is required!

Structured Query Language (SQL)

Interactions with a mySQL database are done using SQL queries.

Making a database query from a Node.JS script

Assuming you have already made a connection:

The mysql2 module supports Promises and thus async/await. So you can also make a database query like this:

Running a database query from the Editor

  1. In the menu, click "Database manager".
  2. Select which database to run the query on.
  3. Write the SQL query somewhere, then select it.
  4. Click Run selected text as query in the database manager widget.

The result from the query will show up in a new file.
You can write additional SQL queries in that file, and the result will be appended to the end of the file.

Importing data, running many queries

Save the queries to a file. Then run the following query in the editor:

Misc

Passwordless authentication (auth_socket)

The editor uses auth_socket mySQL plugin for authentication to the database to make it possible to login securely to the mySQL server without using a password.

The only mysql module I have found that works with auth_socket is mysql2.
And you have to specify authSwitchHandler in the connection options. See example above.