Home > php教程 > php手册 > MongoDB安装,mongodb

MongoDB安装,mongodb

WBOY
Release: 2016-06-13 09:03:30
Original
1016 people have browsed it

MongoDB安装,mongodb

1. 准备所需工具

1) Windows 7 64bit

2) MongoDB 浏览

2. 安装

1) 将mongodb-win32-x86_64-3.0.3.zip 解压到d:\program_files\MongoDB

2) d:\program_files\MongoDB\bin 添加到环境变量%mongo%

3) 创建目录%mongo%\data\db 用于存放数据库

4) 创建目录%mongo%\data\log 用于存放日志

5) 创建并编辑配置文件 %mongo%\mongod.cfg

dbpath=<span>D:\program_files\MongoDB\data\db
logpath</span>=D:\program_files\MongoDB\data\log\mongo.log
Copy after login

6) 将MongoDB安装为服务

以管理员权限运行下面的命令创建MongoDB服务

sc create MongoDB binPath= <span>"</span><span>\</span><span>"</span>D:\program_files\MongoDB\bin\mongod.exe\<span>"</span><span> --service --config=\</span><span>"</span>D:\program_files\MongoDB\mongod.cfg\<span>""</span><span><br /></span>
Copy after login

7) 启动服务

net start mongodb
Copy after login

3. 使用

1) 启动命令行,输入mongo

2) show dbs

3) use test

4) insert

5) find

4. PHP 开发

1) 搭建PHP环境 浏览

2) 下载MongoDB PHP扩展 浏览,并放到%PHP%\ext目录下

3) 修改php.ini,加入如下代码

extension=php_mongo.dll
Copy after login

4) 重启Apache服务器

5) MongoDB PHP 手册 浏览

 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template