start mongo serve code example Example 1: start mongodb sudo systemctl start mongod Example 2: start mongod mongod --dbpath <file_path> --port <port>