mysql daemon install as a service on windows - service

I just downloaded mysql 64 bit as a zip package from their website, extract it to c:\mysql
and added c:\mysql\bin to my path.
I then open a command prompt as administrator and run:
mysqld -install
To install the mysql server as a service. I then go to windows services and start MySQL (also tried sc start MySQL from cmd), but I get the following error message:
Upon inspecting the properties of the service, it shows the path as C:\Program Files\MySQL-5.6.17\bin\ instead of C:\mysql\bin. Any ideas why this is happening?

Use the FULL PATH of your mysql server exe
Try this:
"C:\mysql\bin\mysqld" -install
It turns out that the service installation routine expects the .exe to be at the MySQL default installation directory of C:\Program Files\MySQL-5.6.17\bin\
Your installation with the straightforward mysqld -install could work, albeit only partially, because you had the correct path under Windows PATH
This is certainly a great inadequacy in the MySQL documentation, which does not address this issue at all.
Knowing you might have resolved your problem one way or another, I still thought to post this here as it might be of help to someone with time!
Cheers.

Related

bash: powershell: command not found

For a node project I will have to work on a remote server and for that I will use filzilla for file transfer and ssh for console.
I use Visual Studio Code, I installed a remote ssh extension,
I did the hostname and user configurations as well as secretkey,
because before that I had another error The process tried to write to a nonexistent pipe ,
which I finally solved but now after I start ssh and log in with the password in cmd from Visual Studio Code, I get this error bash: powershell: command not found.
I tried one day to search the internet for that error.
https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_server_configuration?WT.mc_id=-blog-scottha
https://learn.microsoft.com/en-us/windows/wsl/troubleshooting
I've talked to people who have more experience but within the time limit my advice could be, but I still couldn't solve the error, either it's something from windows or ssh or I don't know.
You are the first time I try to do this in general I used heroku or aws that had some facilities.
I changed host machine in the settings JSON file windows to linux
When you got the option to Select Linux, Windows or Mac did you make sure that you know exactly the type of server you are connecting to. Bcs if you choose the wrong one this error gets thrown.

MongoDB (ServerService) not installing on windows10

I am trying to install mongodb on my windows10 computer, but keep getting error that I don't have the privileges, even though I am the admin user.
I tried running the msi installer getting the error. So I tried the commands shown in the docs https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows-unattended/#procedure using the terminal running as admin, but getting the same error as seen below.
I am trying to install it on my D:/ Drive. But I also tried installing it in the default C:/Program Files/MongoDB/Server/4.4/ but it didn't work as well.
cmd: msiexec.exe /l*v mdbinstall.log /qb /i mongodb-windows-x86_64-4.4.3-signed.msi INSTALLLOCATION="D:\Program_Files\MongoDB\Server\4.4\" ADDLOCAL="ServerService,Client,Router,MiscellaneousTools" SHOULD_INSTALL_COMPASS="0"
The log on as a service user right allows accounts to start or run services on a Windows machine. By default, and due to security reasons, services can only be configured to run under the Local System, Local Service or Network Service accounts which have a built-in right to log on as a service. Any other user account that requires to run a service must be assigned this right.
Run gpedit.msc.
Navigate to Computer Configuration > Windows Settings > Security Settings > Local Policies >User Rights Assignment.
In the details pane, double-click Log on as a service.
Click Add User or Group and add the account to the list of accounts that have the Log on as a service right. Once you have selected the user, click OK.
Click OK and close the policy editor.
References :
https://learn.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/log-on-as-a-service
No matter what I tried, I just couldn't get the Server Service to install on my system through the msi, using either the gui or command line.
So finally I installed it without checking the "Install MongoD as a Service" option.
It successfully installed the mongodb including the mongod.exe in the bin (finally).
Then ->
Set the environment variables PATH to my bin folder
Create the /data/db and /log/mongo.log in the directory you want
Type the command mongod --directoryperdb --dbpath <your_dir_path>\data\db --logpath <your_dir_path>\log\mongo.log --install
Type the command net start MongoDB
And you will have the mongodb service running as I did.

mongodb installation. service failed to start

Installing MongoDB as a service is failing for me. The install gets to the point where it tries to start the service and then fails:
Service 'MongoDB Server' (MongoDB) failed to start. Verify that you have sufficient privileges to start system services
This in on a freshly updated new install of Windows 2016
Near default MongoDB 4.2 community install.
Install MongodB as a Service
- Run service as Network Service user.
Directories are not default.
Data Directory : C:\Database\Data
Log Directory : C:\Database\Log
I've granted Network Service full permissions on C:\Database
.net framework 4.6 is installed.
Am I the first person to install MongoDB as a service or something?
Hard to believe someone didn't catch this before.
Update:
Installing to the default directories works. Brutal QA. Any fix to this?
Well, in case someone else comes across this...
One solution is to just install to the default directories, then after the install is done, stop the service, change the cfg to point to the directories you want and copy the files over. Then start it up.
Check path of the MongoDB service by runninng Win+R, type services.msc in opened window find MongoDB server double click it. Here what I see when installed MongoDB to custom folder C:\mongodb MongoDB server path
You probably need to install it into default folder or change path to executable in services.
In latter case run Win+R type there regedit.exe go to
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MongoDB and change ImagePath key.
In my case key was "C:\Program Files\MongoDB\Server\4.2\bin\mongod.exe" --config "C:\Program Files\MongoDB\Server\4.2\bin\mongod.cfg" --service
and I changed it into "C:\mongodb\bin\mongod.exe" --config "C:\mongodb\bin\mongod.cfg" --service
restart

How can I confirm that Postgres had been installed properly for Heroku use?

I am using Heroku and thus the Postgres is needed to be properly installed.
I used the Windows Installer "postgresql-10.1-3-windows-x64.exe" for my installation, and there was not special interruption during the installation.
However, after I deployed a Heroku app on web, and try to run ">pipenv --three" in my cmd windows, there's a message of ' "command" is not recognized as an internal or external command, operable program or batch file.', which make me not sure whether Postgres is properly installed.
I also tried to run the command "heroku pg:psql", and the result is as below:-
heroku pg:psql
Is that really because the Postgres is not properly installed, and how can I get it fixed? Thank you in advance for the help!
Environment:-
Windows 10 Home - 64-bit
Postgre Installer: postgresql-10.1-3-windows-x64.exe
Heroku: heroku-cli/6.15.18-fd2097 (win32-x64) node-v9.3.0
I finally got it solved, by adding the following into the $PATH.
%APPDATA%\Python\Python36\Scripts
It's not the matter of the installation.
Thx.

Windows could not start mongodb service on local computer. For more info., review the System Event Log

I am using Windows 32-bit machine and tried to start MongoDB service from Windows > services as shown below.
However, I am unable to start the MongoDB service from it and throws the following error.
When I try using cmd prompt, I am getting the following error:
Network Failed to connect to 127.0.0.1:27017, reason: errno:10061 No
connection could be made because the target machine actively refused
it.
Error: Couldn't connect to server 127.0.0.1:27017 <127.0.0.1>,
connection attempt failed.
I had same an issue.
Try to remove mongod.lock file from your Mongo data directory.
For example mine is "C:\Program Files\MongoDB\Data\mongod.lock" and after deleting file start the MongoDB service and it's work like charm.
In case someone else is running into this problem, just read your Log files and you will be able to find the problem, for me after trying to install it inside wamp directory when I run the MongoDB service it gave me the same error message, I went to the logs and find out that I was missing a directory inside my data directory which is called db, once I have created this directory the service run perfectly.
MongoDB uses a default folder to store its files. On Windows, the default location is C:\data\db.
Maybe that folder doesn´t exist. In that case just creat it or change the default location of Mongo service using the --dbpath command-line flag.
So I just had the same problem, running on Windows 10. The reason why MongoDB didn't start was because the path to the data and logs was not correctly set. This has already been pointed out, but my solution is different. Look in C:\Program Files\MongoDB\Server\4.0\bin (or wherever your mongoDB is installed). There is a config file called mongod.cfg. Check that
storage:
dbPath:
and
systemLog:
path:
Is set to what you want. In my case, it was using environment variables %MONGODBPATH% or similar that was not set by Windows. By default, the log and data should point to C:\Program Files\MongoDB\Server\4.0\data and C:\Program Files\MongoDB\Server\4.0\log\mongod.log respectively.
There was a npm: in last line of mongodb configuration file which is located in the installation folder in the bin\mongod.cfg
I commented out that line and started the service and it is working like charm.
I concluded this by running the mongodb service command from windows command line(cmd) and I got an error.
I ran this to spot the error:
C:\Program Files\MongoDB\Server\4.2\bin\mongod.exe --config "C:\Program Files\MongoDB\Server\4.2\bin\mongod.cfg" --service
mongod.lock deletion did not helped me, repair did not help either. In my case it was due to one of database happened to be corrupted, I moved all dbs to another directory and then copied them back one by one and re-starting mongodb service to figure out what db file is corrupted. It's definitely MongoDb bug
I had the same error message. Try to locate the mongodb log files and look at the last entries. My issue was clearly stated there, a missing directory :
2019-01-29T16:59:44.424+0100 I STORAGE [initandlisten] exception in
initAndListen: NonExistentPath: Data directory
C:\wamp64\bin\mongodb\mongodb-win32-x86_64-2008plus-ssl-3.6.10\data\db
not found., terminating
The advice of checking the log was what helped me. In this case:
The MongoDB service could not be started. A service specific error occurred: 100
turns out I had a problem with some databases created with WiredTiger while the mongod.cfg specified engine was: mmapv1
So I basically removed the content of the folder c:/data/db/ and then used the command net start MondoBD --repair and worked. Uffff it´s been 2 days.
I'm here a bit late, very late actually. But may it works something out for the ones facing this issue now. Mongodb configuration file in Windows OS is under 'C:\Program Files\MongoDB\Server\%YOUR MONGO VERSION%'.
I had changed this file and manipulated the bindip field, so I was getting the same error. It should be 127.0.0.1 or your machine's IP address which you can find it by 'ipconfig/all' command in cmd. So I fixed bindip and the service starts with no problems.
stuck on the same issue, but got the solution by hit and trial, just create a new folder for path "C:\data\db" then go to your command prompt and type 'mongod', your database server will start.
For me it was a port problem :
just search and kill the process using the port 27017
for linux : https://bobcares.com/blog/mongodb-error-code-48/
for windows : How do I kill the process currently using a port on localhost in Windows?
I have found out that Visual C++ Redistributable was missing in my Windows 7 Machine. After installing it worked.
For Windows 10 users
specify database location, if don't know create the below-mentioned directory and always use this
open cmd
mkdir C:\users\{username}\data
cd C:\users\{username}\data
mongod --dbpath .
start mongodb server
open cmd
mongod --dbpath C:\users\{username}\data
stop mongodb
open cmd
mongo
if server is running, run:
use admin
db.shutdownServer()
quit()
In my case, this happened because I did not stop MongoDB from docker. after I stopped the process the error was gone.
In my case, it was the docker with MongoDB running on the same port. So after I stopped the container, the service is then successfully starting.