Search code examples
mysqlmongodbterminalubuntu-14.04ampps

Using MongoDB in terminal which is running by AMPPS in ubuntu


I have AMPPS up and running in my ubuntu which is in /usr/local/ampps/ directory.

I want to use MongoDB which is available in AMPPS - I have started the MongoDB server from AMPPS control panel.

but I'm not able to use it from terminal,I'm in /usr/local/ampps/mongodb/bin/ directory and when I'm using ./mongo db mydb I get :

MongoDB shell version: 3.2.0
connecting to: use
2016-10-04T09:29:04.921+0330 E -        [main] file [mydb] doesn't exist
failed to load: mydb

How can I use mongoDB from terminal ?

FYI : I used mysql which it was running by AMPPS in terminal this way :

cd /usr/local/ampps/mysql/bin/
./mysql -u root -p 

And I was able to use mysql from terminal.


Solution

  • I've Figured how to do this, just cd in the AMPPS folder :

    cd /usr/local/ampps/mongodb/bin
    

    Then run :

    ./mongo
    

    you will get something like this :

    MongoDB shell version: 3.2.0
    connecting to: test
    Welcome to the MongoDB shell.
    For interactive help, type "help".
    For more comprehensive documentation, see
        http://docs.mongodb.org/
    Questions? Try the support group
        http://groups.google.com/group/mongodb-user
    Server has startup warnings: 
    2016-10-04T09:08:12.567+0330 I CONTROL  [main] ** WARNING: --rest is specified without --httpinterface,
    2016-10-04T09:08:12.567+0330 I CONTROL  [main] **          enabling http interface
    2016-10-04T09:08:38.127+0330 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
    2016-10-04T09:08:38.127+0330 I CONTROL  [initandlisten] 
    2016-10-04T09:08:38.127+0330 I CONTROL  [initandlisten] 
    2016-10-04T09:08:38.127+0330 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
    2016-10-04T09:08:38.127+0330 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
    2016-10-04T09:08:38.127+0330 I CONTROL  [initandlisten] 
    2016-10-04T09:08:38.127+0330 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
    2016-10-04T09:08:38.127+0330 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
    2016-10-04T09:08:38.127+0330 I CONTROL  [initandlisten] 
    >
    

    And as you can see you can type your commands in front of > like :

    > show dbs
    admin  0.078GB
    local  0.078GB
    mydb   0.078GB
    >