> For the complete documentation index, see [llms.txt](https://docs.percona.com/proxysql/llms.txt).

# Build the pxc_scheduler_handler tool

This task guide builds `pxc_scheduler_handler` from source. For package manager installs, see [Install Percona build of ProxySQL and the admin tools](https://docs.percona.com/proxysql/install-v2.md).

The `pxc_scheduler_handler` tool includes two main files: the `pxc_scheduler_handler` binary and the `percona_scheduler_admin` script.

The `pxc_scheduler_handler` binary performs the following tasks:

- Evaluates the cluster state and scenario
- Monitors cluster health
- Performs actions, including failover during an incident

The `percona_scheduler_admin` script runs `pxc_scheduler_handler` and returns responses from the configuration file.

`pxc_scheduler_handler` requires `percona_scheduler_admin` for normal operation. Manual intervention is required without `percona_scheduler_admin`.

A git clone with submodules does not check out submodule content. Submodules require initialization and update before the build.

## Build the scheduler submodule

Complete the following steps to build `pxc_scheduler_handler`:

1. Initialize git submodules:

   ```bash
   $ git submodule update --init
   ```

1. Build the scheduler submodule:

   ```bash
   $ build_scheduler.sh
   ```

The build writes the `pxc_scheduler_handler` binary to the repository base directory.

Do not run multiple instances of `pxc_scheduler_handler`. A second instance started while another instance runs causes the following results:

- Additional network and system resource consumption
- Identical results from both instances because both read the same configuration file

## Create a MySQL admin account

Create an `admin` user account for communication between ProxySQL and `pxc_scheduler_handler`.

On MySQL 8.0 environments that still allow it, you can create the account with `mysql_native_password`:

```bash
mysql> CREATE USER 'admin'@'192.%' IDENTIFIED WITH 'mysql_native_password'
by 'admin';
```

[ProxySQL 2.6.2](https://docs.percona.com/proxysql/2.6.2.md) and later releases support `caching_sha2_password` authentication. Use this method for MySQL 9.x (where `mysql_native_password` is removed) and for any environment that requires SHA-2 authentication:

```bash
mysql> CREATE USER 'admin'@'192.%' IDENTIFIED WITH 'caching_sha2_password' BY 'admin';
```

If MySQL 9.x is the only client available on the ProxySQL host, also set `mysql-default_authentication_plugin` to `caching_sha2_password`. See [Connect to ProxySQL with MySQL 9.x clients](https://docs.percona.com/proxysql/mysql-9-authentication.md).

Grant privileges to the `admin` account:

```bash
mysql> GRANT ALL PRIVILEGES ON *.* TO 'admin'@'192.%' WITH GRANT OPTION;
```

For configuration details, see [pxc_scheduler_handler overview](https://docs.percona.com/proxysql/psh-overview.md) and [configuration file reference](https://docs.percona.com/proxysql/psh-configuration.md).

Related topic

[Log file or lock file locations](https://docs.percona.com/proxysql/psh-known-limitations.md#do-not-place-the-log-file-or-lock-file-in-the-home-directory)
