When installing some software, often because of various permissions restrictions, resulting in installation failure or a bug, such as MongoDB, I finally installed with PowerShell, the success did not appear bug, or there will be
Service ' MongoDB server ' failed to start verify the sufficient privileges to start system services
Such a problem! The procedure for installing with Powersheel is as follows, if you are in Win10, right-click on the Start menu in the lower left corner and click on the "Windows PowerShell (Administrator)" option to open an administrator command line mode that is higher than the CMD permission, and then enter the absolute path of the file directly: Then all the way next can be installed successfully, as to choose the default installation path, or custom (customized), whatever you, if you suspect the default path "C:\Programme files\mongodb\server\4.0" too long, you can also change to "C \ MongoDB "or D, f disk and other places. In fact, the path is not related to the long point, because you can add "[Installed Path]\bin" in the system environment variable to subtract the subsequent input path in the command line trouble. In fact, after the MongoDB service is set to boot, the call to MongoDB in Python does not require any settings, so it is really not necessary to shorten the path, after all, your data is in the database directory, Therefore, the data directory on the C-drive or D-disk root directory in the subsequent use to bring convenience. Here's how to set up boot-up:
#mongod--dbpath=[dbpath]--logpath=[logpath]--install--servicename= "MongoDB" #比如, if you set DBPath for C:\data\db, LogPath is C:\data\log\MongoDB.log, you can enter: Mongod--dbpath=c:\data\db--logpath=c:\data\log\mongodb.log--install-- Servicename= "MongoDB" #其中, when you enter a path on the command line, in the form of a string, especially when you enter several paths side by side, such as creating two files in the same directory: MD "file_1" "C:\xxx\file_2" #此外, Using spaces in the command line is equivalent to using an equal sign, so the command line can be written as well; Mongod--dbpath "C:\data\db"--logpath "C:\data\log\MongoDB.log"--install--servicename "MongoDB"
Installing MongoDB's blood-spitting experience under Windows 10