我在我的ubuntu中运行了AMPPS并在/usr/local/ampps/
目录中运行。
我想使用AMPPS中提供的MongoDB - 我已经从AMPPS控制面板启动了MongoDB服务器。
但是我无法在终端上使用它,我在/usr/local/ampps/mongodb/bin/
目录中,当我使用./mongo db mydb
时,我得到:
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
如何从终端使用mongoDB?
仅供参考:我使用mysql,这是由AMPPS以终端方式运行的:
cd /usr/local/ampps/mysql/bin/
./mysql -u root -p
我能够从终端使用mysql。
答案 0 :(得分:0)
我已经想过如何做到这一点,只需在AMPPS文件夹中cd:
if (empty($_POST['nick-cc'])) {
$nccn = NULL;
} else {
$nccn = ' AND cc = %'.$_POST['nick-cc'].'%';
}
$sql = "SELECT * FROM pcr WHERE student = $user->id $nccn";
然后运行:
cd /usr/local/ampps/mongodb/bin
你会得到这样的东西:
./mongo
正如您所看到的,您可以在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]
>
前面输入命令,如:
>