1

I have looked for an easy way to start a mysql from the command line.

I know about

" shell> "C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld" The path to mysqld may vary depending on the install location of MySQL on your system. "

But I want something more like linux where you can type "sudo service mysql stop/start/status"

I have the mysql path setup so I can run mysql commands like "mysql -u root -p"

I am not sure if it is possible either. I want to know if anyone has a way to do this.

T0MSSM0T
  • 21
  • 1
  • 3
  • if mySQL installs itself as a Windows Service (I don't know if it does, but it ought to) then you should be able to start/stop the service using powershell I'd have thought, providing your account has the required privileges. – ADyson Jul 12 '17 at 15:47
  • you could set mysql as windows service https://stackoverflow.com/questions/5679258/mysql-service-is-missing – ToujouAya Jul 12 '17 at 15:47
  • What does making mysql a window service do? I followed the link and tried to do "mysqld --install" then "mysqladmin -u root shutdown" which shut it down but then "mysqladmin start" and it cant connect to it. I should mention I know I can start it in services already. – T0MSSM0T Jul 12 '17 at 15:57
  • windows services can be stopped/started from a shell, definitely powershell and maybe command line I don't know. Pretty sure it's the same command for every service, just change the name. You can look up the syntax. Anyway really that general principle answers your question. If MySQL itself won't start for some other reason that's a separate issue. – ADyson Jul 12 '17 at 19:35

1 Answers1

1

Using the help from the comments I have solved my issue, for anyone else.

  1. When I installed mysql it gave me the option to name the service for the server

Mine is called "MySQL57" (this meant mine was already a service. If your's isn't I would follow this: Mysql service is missing although I can't guarantee it worked)

If you aren't sure you can open services with: windows key + R then type in "services.msc"

  1. You can start and stop windows services with "net start/stop service-name" For CMD I need to run as admin then type "net start mysql57"
T0MSSM0T
  • 21
  • 1
  • 3