4

I have installed MongoDB using

sudo apt-get install mongodb

Mongo shell is working well but when I run mongod in terminal, I get

2020-08-04T19:56:20.432+0400 I CONTROL  [initandlisten] MongoDB starting : pid=4079 port=27017 dbpath=/data/db 64-bit host=ideapad-15ikb
2020-08-04T19:56:20.432+0400 I CONTROL  [initandlisten] db version v3.6.8
2020-08-04T19:56:20.432+0400 I CONTROL  [initandlisten] git version: 8e540c0b6db93ce994cc548f000900bdc740f80a
2020-08-04T19:56:20.432+0400 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.1.1f  31 Mar 2020
2020-08-04T19:56:20.432+0400 I CONTROL  [initandlisten] allocator: tcmalloc
2020-08-04T19:56:20.432+0400 I CONTROL  [initandlisten] modules: none
2020-08-04T19:56:20.432+0400 I CONTROL  [initandlisten] build environment:
2020-08-04T19:56:20.432+0400 I CONTROL  [initandlisten]     distarch: x86_64
2020-08-04T19:56:20.432+0400 I CONTROL  [initandlisten]     target_arch: x86_64
2020-08-04T19:56:20.432+0400 I CONTROL  [initandlisten] options: {}
2020-08-04T19:56:20.433+0400 I STORAGE  [initandlisten] exception in initAndListen: NonExistentPath: Data directory /data/db not found., terminating
2020-08-04T19:56:20.433+0400 I CONTROL  [initandlisten] now exiting
2020-08-04T19:56:20.433+0400 I CONTROL  [initandlisten] shutting down with code:100

1 Answer 1

2

All I need was to create new folder in the root sudo mkdir -p /data/db/ then run this command

sudo chown $(id -u) /data/db

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .