57

I have installed Mysql server locally and everything was working Ok but today when I tried to get a connection to the local db, I got an error. After checking services showed that the MySql service is missing.

What is the problem?

starball
  • 20,030
  • 7
  • 43
  • 238
Igal
  • 4,603
  • 14
  • 41
  • 66
  • Maybe just mysql service is not running ? Have you started it ? – hsz Apr 15 '11 at 15:50
  • this service was auto started each time i log into windows but now the service is absent from services list – Igal Apr 15 '11 at 15:52

6 Answers6

90

I have done it by the following way

You must run in Administrator

  1. Start cmd
  2. Go to the "C:\Program Files\MySQL\MySQL Server 5.6\bin"
  3. type mysqld --install

Like the following image. See for more information.

enter image description here

lava
  • 6,020
  • 2
  • 31
  • 28
Atish Kumar Dipongkor
  • 10,220
  • 9
  • 49
  • 77
4

I also face the same problem. do the simple steps

  1. Go to bin directory copy the path and set it as a environment variable.
  2. Run the command prompt as admin and cd to bin directory:
  3. Run command : mysqld –install
  4. Now the services are successfully installed
  5. Start the service in service windows of os
  6. Type mysql and go
kavi temre
  • 1,321
  • 2
  • 14
  • 21
4

Go to your mysql bin directory and install mysql service again:

c:
cd \mysql\bin
mysqld-nt.exe --install

or if mysqld-nt.exe is missing (depending on version):

mysqld.exe --install

Then go to services, start the service and set it to automatic start.

NickSoft
  • 3,215
  • 5
  • 27
  • 48
  • 1
    i've found the problem. the service has disappeared after i've installed new CCleaner ver see here : – Igal Apr 17 '11 at 21:49
  • 3
    Just wanted to point out that on Windows you might have to disable UAC or run CMD as an administrator for this to work (I had to do the latter for it to work) other wise you get a message that states "Install/Remove of the service is denied" - more info here http://forums.mysql.com/read.php?11,497008,498205#msg-498205 – Sean Aug 05 '13 at 09:29
  • `cd "C:\Program Files\MySQL\MySQL Cluster 8.0\bin"` ---- then ---- `mysqld.exe --install` – JayRizzo Jul 26 '23 at 04:32
2

I came across the same problem. I properly installed the MYSQL Workbench 6.x, but faced the connection as below:

enter image description here

I did a bit R&D on this and found that MySQL service in service.msc is not present. To achieve this I created a new connection in MySQL Workbench then manually configured the MySQL Database Server in "System Profile" (see the below picture).

You also need to install MySQL Database Server and set a configuration file path for my.ini. Now at last test the connection (make sure MySQL service is running in services.msc).

enter image description here

halfer
  • 19,824
  • 17
  • 99
  • 186
Ram
  • 3,887
  • 4
  • 27
  • 49
2

If you wish to have your config file on a different path you have to give your service a name:

mysqld --install NAME --defaults-file=C:\my-opts2.cnf

You can also use the name to install multiple mysql services listening on different sockets if you need that for some reason. You can see why it's failing by copying the execution path and adding --console to the end in the terminal. Finally, you can modify the starting path of a service by regediting:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\NAME

That works well but it isn't as useful because the windows service mechanism provides little logging capabilities.

Jappie Kerk
  • 1,257
  • 12
  • 16
0

Go to

C:\Program Files\MySQL\MySQL Server 5.2\bin

then Open MySQLInstanceConfig file

then complete the wizard.

Click finish

Solve the problem

I think this is the best way to change the port number also.

It works for me

Vighnu
  • 11