自从MongoDB升级到2.4之后,User系统,或者说是权限系统有了翻天覆地的变化。 在MongoDB2.4之前的User系统,除了用户名和密码之外,只有一个ReadOnly属性。 如果一个用户在admin数据库里面进行了登陆,则admin数据库里面的Readonly属性将被沿用到其他所有的
自从MongoDB升级到2.4之后,User系统,或者说是权限系统有了翻天覆地的变化。
在MongoDB2.4之前的User系统,除了用户名和密码之外,只有一个ReadOnly属性。
如果一个用户在admin数据库里面进行了登陆,则admin数据库里面的Readonly属性将被沿用到其他所有的数据库。
这样的权限管理当然是最最容易管理的,任何能够登入到MongoDB的用户,如果在Admin的数据库的用户表里面存在记录,则对于整个服务器上的所有数据库的访问权限也就固定下来了。
当然,用户可以了在个别的数据库的用户表中定义自己的权限。所谓的权限也就是只读或者非只读。
到了2.4之后,MongoDB的用户模型发生了很大的变化
MongoUser(2.4之前)
用户名
密码
是否只读
MongoUser(2.4之后)
用户名
密码
角色
其他数据库角色(如果该用户在Admin数据库的User表里面登陆的话,可以个别指定对于具体数据库访问的权限)
外部验证
“角色”这个概念,也“是否只读”比起来,内容丰富多了,不同的角色可以进行的操作是不同的,有的可以管理用户,看得到用户表,有的只能看到普通的数据表。
最近一直在对用户和权限进行研究,总结了一下心得:
1.由于要顾及以前的版本,ReadOnly属性还是可以使用的,不过,ReadOnly和Role是不能共存的
2.密码和外部验证,也是不能共存的,要么用密码验证身份,要么用外部验证数据库来验证身份
3.其他数据库角色只能在Admin里面进行登录。
接下来说说坑爹的C#的驱动程序:C#的驱动程序,对于MongoUser的巨大变化,还没有开始进行对应。自己动手丰衣足食,我现在的开发都是使用自己改写的MongoUser类。
我不是很明白,为什么C#驱动不对应MongoUser的变化,我也不清楚其他语言的驱动程序是否也没有对应。。。。
这里是新的添加用户的GUI
添加了用户后,请不要忘记在启动MongoDB的时候加上 --auth的参数,不然的话,默认是不会启动认证的,不管是谁,都是完全的Admin的权限。
如果对于我的GUI工具感兴趣,Github上面有所有的代码
https://github.com/magicdict/MagicMongoDBTool
这次工具开始尝试提供性能监视工具,当然,只是一个小的尝试罢了。
再说几句题外话,最近IBM宣布和10gen(MongoDB的开发公司)进行合作。我不知道IBM准备多大限度的支持MongoDB。但是不管怎么说,,对于MongoDB的爱好者来说,是一个不错的消息。
MongoDB现在还是冷门的数据库。园子里面也少有介绍MongoDB的文章,或者即使介绍,也是入门级别的。
技术就像赌博一样,谁知道明年的这个时候,Mongo是不是会大红大紫,成为另一个Oracle。不管怎么样,先投资一下吧。。。。。
想要直接体验工具的: Net3.5是必须的。。。。

MySQL'sBLOBissuitableforstoringbinarydatawithinarelationaldatabase,whileNoSQLoptionslikeMongoDB,Redis,andCassandraofferflexible,scalablesolutionsforunstructureddata.BLOBissimplerbutcanslowdownperformancewithlargedata;NoSQLprovidesbetterscalabilityand

ToaddauserinMySQL,use:CREATEUSER'username'@'host'IDENTIFIEDBY'password';Here'showtodoitsecurely:1)Choosethehostcarefullytocontrolaccess.2)SetresourcelimitswithoptionslikeMAX_QUERIES_PER_HOUR.3)Usestrong,uniquepasswords.4)EnforceSSL/TLSconnectionswith

ToavoidcommonmistakeswithstringdatatypesinMySQL,understandstringtypenuances,choosetherighttype,andmanageencodingandcollationsettingseffectively.1)UseCHARforfixed-lengthstrings,VARCHARforvariable-length,andTEXT/BLOBforlargerdata.2)Setcorrectcharacters

MySQloffersechar, Varchar, text, Anddenumforstringdata.usecharforfixed-Lengthstrings, VarcharerForvariable-Length, text forlarger text, AndenumforenforcingdataAntegritywithaetofvalues.

Optimizing MySQLBLOB requests can be done through the following strategies: 1. Reduce the frequency of BLOB query, use independent requests or delay loading; 2. Select the appropriate BLOB type (such as TINYBLOB); 3. Separate the BLOB data into separate tables; 4. Compress the BLOB data at the application layer; 5. Index the BLOB metadata. These methods can effectively improve performance by combining monitoring, caching and data sharding in actual applications.

Mastering the method of adding MySQL users is crucial for database administrators and developers because it ensures the security and access control of the database. 1) Create a new user using the CREATEUSER command, 2) Assign permissions through the GRANT command, 3) Use FLUSHPRIVILEGES to ensure permissions take effect, 4) Regularly audit and clean user accounts to maintain performance and security.

ChooseCHARforfixed-lengthdata,VARCHARforvariable-lengthdata,andTEXTforlargetextfields.1)CHARisefficientforconsistent-lengthdatalikecodes.2)VARCHARsuitsvariable-lengthdatalikenames,balancingflexibilityandperformance.3)TEXTisidealforlargetextslikeartic

Best practices for handling string data types and indexes in MySQL include: 1) Selecting the appropriate string type, such as CHAR for fixed length, VARCHAR for variable length, and TEXT for large text; 2) Be cautious in indexing, avoid over-indexing, and create indexes for common queries; 3) Use prefix indexes and full-text indexes to optimize long string searches; 4) Regularly monitor and optimize indexes to keep indexes small and efficient. Through these methods, we can balance read and write performance and improve database efficiency.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.
