博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
各数据库对比
阅读量:3932 次
发布时间:2019-05-23

本文共 1842 字,大约阅读时间需要 6 分钟。

1.数据库分类

现在已有很多大公司使用了NoSQL:Google/Facebook/Adobe

数据库类型 存储类型 部分代表 特点
NoSQL非关系型数据库 文档存储 MongoDB 文档存储一般用类似json的格式存储,存储的内容是文档型的。这样也就有机会对某些字段建立索引,实现关系数据库的某些功能。
key-value存储 Redis 可以通过key快速查询到其value。

2.数据库概念

SQL术语 MongoDB术语 解释/说明
database database 数据库
table collection 数据库表/集合
row document 数据记录行/文档
column field 数据字段/域
index index 索引
primary key primary key 主键,MongoDB自动将_id字段设置为主键

3.数据库启动

3.1 MySQL启动

windows启动

  1. 开启mysql,net start mysql;
    对应的关闭服务命令为 net stop mysql。
    更多命令详见

Linux启动

  1. 开启mysql:service mysql start;
  2. 关闭服务:service mysql stop;
  3. 重启服务:service mysql restart;

3.1 MongoDB启动

为了从命令提示符下运行 MongoDB 服务器,你必须从 MongoDB 目录的 bin 目录中执行 mongod.exe 文件。

C:\mongodb\bin\mongod --dbpath c:\data\db如果执行成功,会输出如下信息:2015-09-25T15:54:09.212+0800 I CONTROL  Hotfix KB2731284 or later update is notinstalled, will zero-out data files2015-09-25T15:54:09.229+0800 I JOURNAL  [initandlisten] journal dir=c:\data\db\journal2015-09-25T15:54:09.237+0800 I JOURNAL  [initandlisten] recover : no journal files present, no recovery needed2015-09-25T15:54:09.290+0800 I JOURNAL  [durability] Durability thread started2015-09-25T15:54:09.294+0800 I CONTROL  [initandlisten] MongoDB starting : pid=2488 port=27017 dbpath=c:\data\db 64-bit host=WIN-1VONBJOCE882015-09-25T15:54:09.296+0800 I CONTROL  [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R22015-09-25T15:54:09.298+0800 I CONTROL  [initandlisten] db version v3.0.6……

4 数据库连接

MongoDB连接URI:

mongodb://[username:password@]host1[:port1][,host2[:port2],…[,hostN[:portN]]][/[database][?options]]

  • mongodb:// 这是固定的格式,必须要指定。

  • username:password@ 可选项,如果设置,在连接数据库服务器之后,驱动都会尝试登录这个数据库

  • host1 必须的指定至少一个host, host1 是这个URI唯一要填写的。它指定了要连接服务器的地址。如果要连接复制集,请指定多个主机地址。

  • portX 可选的指定端口,如果不填,默认为27017

  • /database 如果指定username:password@,连接并验证登录指定数据库。若不指定,默认打开 test 数据库。

  • ?options 是连接选项。如果不使用/database,则前面需要加上/。所有连接选项都是键值对name=value,键值对之间通过&或;(分号)隔开

转载地址:http://bzqgn.baihongyu.com/

你可能感兴趣的文章
using matlab drawing line graph for latex
查看>>
How package finding works
查看>>
build opencv3.3.0 with VTK8.0, CUDA9.0 on ubuntu9.0
查看>>
how to compile kinfu_remake with cuda 9.0 opencv2.4.13.4
查看>>
qtcreator4.4.1中cmake 与cmake3.5.1本身generate出来的setting是有区别的解决方法
查看>>
CMake Useful Variables/Logging Useful Variables
查看>>
使用cmake建立工程链接OPENNI2
查看>>
ubuntu下解决csdn网页打不开的问题
查看>>
uninstall software on ubuntu
查看>>
install kinnect senor on ubuntu
查看>>
calibrate kinnect v1 on ubuntu
查看>>
flann中关于数据的stride
查看>>
cv::Mat ptr 和 at 注意事项
查看>>
cuda更新过后, findcuda找不到怎么办?
查看>>
cast shared_ptr to shared_ptr
查看>>
Elastic Job入门示例-实现DataflowJob接口
查看>>
Elastic Job入门示例-Console控制台
查看>>
Elastic Job入门示例-实现原理介绍
查看>>
HTTP状态码对照表
查看>>
Spring Cloud Feign 服务间调用 -超时
查看>>