When i run the below 2 command i'm getting the following errors
1) Gayathri-MacBook-Pro:~ Gayathri$ mongodb/bin/mongo
2016-04-29T15:17:42.988+0530 I STORAGE [main] In File::open(), ::open for '/Users/Gayathri/.mongorc.js' failed with errno:13 Permission denied
The ".mongorc.js" file located in your home folder could not be executed
2) Gayathri-MacBook-Pro:~ Gayathri$ mongodb/bin/mongod
2016-04-29T15:23:35.125+0530 I - [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2016-04-29T15:23:35.125+0530 I STORAGE [initandlisten] exception in initAndListen: 98 Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating
2016-04-29T15:23:35.125+0530 I CONTROL [initandlisten] dbexit: rc: 100
2016-04-29T15:11:19.330+0530 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
Now i wanted to know whether giving sudo command and started the mongo server and client is right ????. If its wrong then what are the steps to correct the permission issue. Kindly let me know the steps in detail.
chown Gayathri:<your group>/Users/Gayathri/.mongorc.js