Usually, I can start MySQL service on windows use command in the cmd window with administration privilege, like:
net start mysql
admin prompt
success start mysql
We can see it works well.
Sometimes, I dont wanna open the command prompt with administrative privileges. Instead, I prefer to use an already open command prompt window that isn’t running with administrative privileges. However, under these circumstances, the command to start the MySQL service doesn’t work.
start mysql with error
Opening a new command prompt with administrative privileges every time I need to start the MySQL service feels cumbersome. Is there a way to do this without such hassle?
Cannot start mysql service from normal privilege cmd window.
3
Answers
i see that i can use gsudo.
the link: https://github.com/gerardog/gsudo
After install it, i can use sudo like linux. Although it still requires UAC, it offers much more convenience.
sudo net start mysql
use gsudo to start service
In the following article, you can find four methods for achieving what you need, each one described in detail: https://woshub.com/set-permissions-on-windows-service/
In summary:
Hope this helps
Just execute the RESTART command as a user which has shutdown privileges:
Another option would be to use windows
runas
cmd, however this would require that user "Administrator" is enabled and that you know his credentials.