If you run into troubles, got a suggestion, or issue, please e-mail email@example.com
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:
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
- In the menu, click "Database manager".
- Select which database to run the query on.
- Write the SQL query somewhere, then select it.
- 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:
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.