How to Install MongoDB on Hosting - Currently the term database is familiar. What used to be known only by programmers or IT people, has now spread to all circles. Databases contain data sets that can be managed such as searching for information, storing information and disposing of information. One type of database that is widely used today is MongoDB. According to wikipedia, MongoDB is a NoSQL database system that has no relations, the data stored is not in table format, and uses a JSON structure to store data. MongoDB is widely used to store data because it has the advantages needed by many people. MongoDB is capable of storing large and varied amounts of data, has high performance, and does not require a table structure. However, unfortunately not many hosting providers support MongoDB. Relax… Don't worry! Now KincaiHosting supports MongoDB ... Well, this guide will explain how to install MongoDB on Hosting.

How to Install MongoDB on Hosting

Below are the steps for installing MongoDB on Hosting, including:

1. Enable MongoDB

What you need to do first is activate MongoDB on hosting. Before that, make sure you log in to cPanel first. You can login to cPanel hosting via https://domainname/cpanel or please read How to Login cPanel HostingAfter successfully entering cPanel hosting, you can type MongoDBin the search field and click MongoDB.

Then you can click Installto start activating MongoDB on hosting. Anyway, keep in mind that KincaiHosting MongoDB will run when Hosting is Super and above.

This process takes about 2-3 minutes. If it will appear like the gambah below.

 

2. Create a MongoDB Admin User

The next step is to create a MongoDB admin user. Admin user is used so you can access the database on MongoDB. MongoDB runs using a socket file so you have to log in via SSH to access it. First of all you can enter SSH via the Linux Terminal or PuTTy. For those of you who don't know how to enter SSH, please read the Guide to SSH Access through Linux Terminals and PuTTy . After you have successfully entered SSH, you can write the command below:

 

$ mongo --host /home/usernamecPanel/mongodb-0.sock

You can see the MongoDB directory path in the menu MongoDBon cPanel. An example is like the image below.

If it is time to create a MongoDB admin user with the following command:

 

> use admin

> db.createUser({

user: "usernamedatabase",

pwd: "xxxxxxxxxx",

roles: [{

role: "root",

db: "admin"

}]

})

For user, pwdand roleyou are free to choose in accordance with your wishes. But in this guide to roleuse "root". As for db, please write admin. If successful will appear as shown below.

After that, before you check whether the admin user was successfully created or not, all you have to do is type exitit in the command prompt. Then start checking by writing the command below:

 

$ mongo --host /home/usernamecPanel/mongodb-0.sock -u "usernamedatabase" -p "xxxxxxxxxx" --authenticationDatabase "admin"

> use admin

> db.auth("usernamedatabase","xxxxxxxxxxx")

> show dbs

When running the db.auth command ("usernamedatabase", "password") the number 1 appears (True), it means that the admin user you created was successful.
Then, you can type exitin the command prompt.

3. Create a MongoDB database

Now you have admin user access. The next step on how to install MongoDB on hosting is to create a MongoDB database. To create a MongoDB database you need to enter using admin user access, which was successfully created or you can type the command below at the command prompt:

 

$ mongo --host /home/usernamecPanel/mongodb-0.sock -u "usernamedatabase" -p "xxxxxxxxxx" --authenticationDatabase "admin"

After successfully logging in, it's time to create a MongoDB database with the command below. In this guide, the database name is milamrsu_test:

 

> use namadatabase

> db.createUser(

{user: "username", pwd: "xxxxxxxx"

, roles: [{ role: "readWrite"

, db: "namadatabase"}]})

When it appears as shown below, it means that you have successfully created a database and installed MongoDB on hosting.

4. Insert Data MongoDB

Now, it is time to try to insert or insert data into MongoDB. All you need to do is write the command below. In this tutorial, for example, we will enter data with the userid, username, and email attributes into it milamrsu_test.

 

$ mongo --host /home/usernamecPanel/mongodb-0.sock -u "usernamedatabase" -p "xxxxxxxxx" --authenticationDatabase "namadatabase"

> use milamrsu_test

> db.milamrsu_test.insert({ "userid": 1, "username": "wawa", "email": "[email protected]"})

> show dbs

When executing the command insert command there is a WriteResult result ({“nInserted”: 1}) then the data you entered has succeeded.

Conclusion

Until now, MongoDB is widely used by all groups. This is because of the advantages of MongoDB that can meet the needs. However, not many hosting providers support MongoDB. Now, hosting at KincaiHosting supports MongoDB, just by enabling MongoDB and doing some configuration MongoDB can run on the hosting.

What is Safelink Asia?

Safelink.asia is a completely free tool where you can create short links. URL security with cryptographic algorithm. Protect your web visitors with a secure link, to avoid viruses, malware, thief, etc. Apart from being free, you get paid! Register now!


Shorten URLs & earn money

So, now you can make money from home, when managing and protecting your links with Safelink Asia. Signup for an account in just 1 minutes. Once you've completed your registration just start creating short URLs and sharing the links with your family and friends. See our proof of payment and publisher rate.


Our partners and network

Here are some of our partners and networks that have collaborated on advertising: 401XD Group, MC Project, Kincai Media, Kartu Nama Digital, SEO Secret Indonesia, Safelink Asia, Media Bisnis, Blackexpo, Adigunawan.net.