Online SQL server helps to connect your project with an online server instead of localhost database setup. To achieve this, the remotemysql site is popular for providing an online database to store our data in a secure way.
Installation of sql module:
- You can visit the link Install sql module. You can install this package by using this command.
npm install sql
- After installing sql you can check your sql version in command prompt using the command.
npm version sql
- After that, you can just create a folder and add a file for example index.js, To run this file you need to run the following command.
- Now go to remotemysql official website and create an account and login, then go to your ‘DATABASES’ section and simply click on ‘CREATE NEW DATABASE’ button. After that you will see the details of your database as shown below:
- Now save these details as this will be required in connection code. Now click on ‘ACTION’ button which is just next to your recently created database and select ‘phpMyAdmin’. Now you will be redirected to your myPhpAdminn portal. Now login with username and password and there you go, you can now create tables and do all SQL operations.
- Now to connect with this database, write down the following code in your index.js file.
Steps to run the program:
- The project structure will look like this:
- Make sure you need install sql by using following commands:
npm install sql
- Run index.js file using below command:
So this is how you can set up an online SQL server setup using remotemysql website.
- Nodejs | Automatic restart NodeJs server with nodemon
- Difference Between Web server and Application server
- Difference between Apache Tomcat server and Apache web server
- Difference between T-SQL and PL-SQL
- Nodejs - Connect MongoDB with Node app using MongooseJS
- Cowsay in Nodejs using Requests library
- Nodejs | Web Crawling using Cheerio
- Web-Socket in NodeJS
- Signup Form Using Nodejs and MongoDB
- Dockerizing a simple Nodejs app
- Nodejs | DNS
- Encrypting Data in NodeJS
- Nodejs | Jimp
- Nodejs – Connect Mysql with Node app
- Nodejs | DNS | setServers()
- NodeJS | Building simple REST API in express
- NodeJs - Handling invalid routes
- Nodejs | authentication using Passportjs and passport-local-mongoose
- Nodejs | GM charcoal() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.