Setting Up MariaDB Proxy as a Windows Service


The MariaDB distribution on Windows includes the mysql-proxy-svc.exe command that enables a MariaDB Proxy instance to be managed by the Windows service control manager. You can control the service, including automatically starting and stopping it during boot, reboot and shutdown, without separately running the MariaDB Proxy application.

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

C:\> sc create 'Proxy' DisplayName= 'MySQL Proxy' start= 'auto' »
 binPath= 'C:\Program Files\MySQL\mysql-proxy-0.8.2\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 is created. To start the service:

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

You can specify additional command-line options to the sc command. You can also set up multiple MariaDB 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.

Retornar