14.6.2.4. Setting Up MySQL Proxy as a Windows Service

The MySQL distribution on Windows includes the mysql-proxy-svc.exe command that enables a MySQL Proxy instance to be managed by the Windows service control manager. This enables you to control the service without separately running the MySQL Proxy application, and allows for automatically starting and stopping the MySQL Proxy service during boot, reboot and shutdown.

To set up a MySQL Proxy service, you must use the sc command to create a new service using the MySQL Proxy service command. Specify the MySQL Proxy options on the sc command line, and identify the service with a unique name. For example, to configure a new MySQL Proxy instance that will automatically start when your system boots, redirecting queries to the local MySQL server:

C:\> sc create "Proxy" DisplayName= "MySQL Proxy" start= "auto" »
  binPath= "C:\Program Files\MySQL\mysql-proxy-0.8.0\bin\mysql-proxy-svc.exe »
  --proxy-backend-addresses=127.0.0.1:3306"
Note

The space following the equal sign after each property is required; failure to include it results in an error.

The preceding command creates a new service called Proxy. You can start and stop the service using the net start|stop command with the service name. The service is not automatically started after it has been created. To start the service:

C:\> net start proxy
The MySQL Proxy service is starting.
The MySQL Proxy service was started successfully.

You can specify any additional command-line options you need to the sc command. You can also set up multiple MySQL Proxy services on the same machine (providing they are configured to listen on different ports and/or IP addresses.

You can delete a service that you have created:

C:\> sc delete proxy

For more information on creating services using sc, see How to create a Windows service by using Sc.exe.

Copyright © 2010-2024 Platon Technologies, s.r.o.           Index | Man stránky | tLDP | Dokumenty | Utilitky | O projekte
Design by styleshout