---
# System prepended metadata

title: proxysql.cnf

---

# proxysql.cnf

documentation found here: https://proxysql.com/documentation/global-variables/

```
# This config uses libconfig. Documented below is the BNF grammar for it.
# For more info see: http://www.hyperrealm.com/libconfig/libconfig_manual.html#Configuration-File-Grammar
#
# configuration = setting-list | empty
# setting-list = setting | setting-list setting
# setting = name (":" | "=") value (";" | "," | empty)
# value = scalar-value | array | list | group
# value-list = value | value-list "," value
# scalar-value = boolean | integer | integer64 | hex | hex64 | float | string
# scalar-value-list = scalar-value | scalar-value-list "," scalar-value
# array = "[" (scalar-value-list | empty) "]"
# list = "(" (value-list | empty) ")"
# group = "{" (setting-list | empty) "}"

datadir = "/var/lib/proxysql"

admin_variables =
{
    admin_credentials="admin:admin;radmin:radmin"
    mysql_ifaces="0.0.0.0:6032"
}

mysql_servers =
(
    {
        address = "mysql-debug"
        port = 3306
        hostgroup = 0
    },
)

mysql_users = 
(
    {
        username = "user"
        password = "password"
    },
)

mysql_variables =
{
    threads=4
    max_connections=2048
    default_query_delay=0
    default_query_timeout=36000000
    have_compress=true
    poll_timeout=2000
    interfaces="0.0.0.0:6033"
    default_schema="information_schema"
    server_version="5.6.40"
    connect_timeout_server=3000
    monitor_username="monitor"
    monitor_password="monitor"
    monitor_history=600000
    monitor_connect_interval=60000
    monitor_ping_interval=10000
    monitor_read_only_interval=1500
    monitor_read_only_timeout=500
    ping_interval_server_msec=120000
    ping_timeout_server=500
    commands_stats=true
    sessions_sort=true
    connect_retries_on_failure=10
}
```

# k8s resources:
```
---
apiVersion: v1
kind: Secret
metadata:
  name: quay-proxysql-config
type: Opaque
data:
  proxysql.cnf: ZGF0YWRpcj0iL3Zhci9saWIvcHJveHlzcWwiCgphZG1pbl92YXJpYWJsZXM9CnsKICAgIGFkbWluX2NyZWRlbnRpYWxzPSJhZG1pbjphZG1pbjtyYWRtaW46cmFkbWluIgogICAgbXlzcWxfaWZhY2VzPSIwLjAuMC4wOjYwMzIiCn0KCm15c3FsX3ZhcmlhYmxlcz0KewogICAgdGhyZWFkcz00CiAgICBtYXhfY29ubmVjdGlvbnM9MjA0OAogICAgZGVmYXVsdF9xdWVyeV9kZWxheT0wCiAgICBkZWZhdWx0X3F1ZXJ5X3RpbWVvdXQ9MzYwMDAwMDAKICAgIGhhdmVfY29tcHJlc3M9dHJ1ZQogICAgcG9sbF90aW1lb3V0PTIwMDAKICAgIGludGVyZmFjZXM9IjAuMC4wLjA6NjAzMyIKICAgIGRlZmF1bHRfc2NoZW1hPSJpbmZvcm1hdGlvbl9zY2hlbWEiCiAgICBzdGFja3NpemU9MTA0ODU3NgogICAgc2VydmVyX3ZlcnNpb249IjUuNS4zMCIKICAgIGNvbm5lY3RfdGltZW91dF9zZXJ2ZXI9MzAwMAogICAgbW9uaXRvcl91c2VybmFtZT0ibW9uaXRvciIKICAgIG1vbml0b3JfcGFzc3dvcmQ9Im1vbml0b3IiCiAgICBtb25pdG9yX2hpc3Rvcnk9NjAwMDAwCiAgICBtb25pdG9yX2Nvbm5lY3RfaW50ZXJ2YWw9NjAwMDAKICAgIG1vbml0b3JfcGluZ19pbnRlcnZhbD0xMDAwMAogICAgbW9uaXRvcl9yZWFkX29ubHlfaW50ZXJ2YWw9MTUwMAogICAgbW9uaXRvcl9yZWFkX29ubHlfdGltZW91dD01MDAKICAgIHBpbmdfaW50ZXJ2YWxfc2VydmVyX21zZWM9MTIwMDAwCiAgICBwaW5nX3RpbWVvdXRfc2VydmVyPTUwMAogICAgY29tbWFuZHNfc3RhdHM9dHJ1ZQogICAgc2Vzc2lvbnNfc29ydD10cnVlCiAgICBjb25uZWN0X3JldHJpZXNfb25fZmFpbHVyZT0xMAp9
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: proxysql-quay
spec:
  replicas: 1
  selector:
    matchLabels:
      quay-component: proxysql
  template:
    metadata:
      labels:
        quay-component: proxysql
    spec:
      containers:
      - image: proxysql/proxysql:2.0.12
        imagePullPolicy: IfNotPresent
        name: proxysql
        ports:
        - containerPort: 6032
          protocol: TCP
        - containerPort: 6033
          protocol: TCP
        volumeMounts:
        - mountPath: /etc/proxysql.cnf
          subPath: proxysql.cnf
          name: configvolume
      volumes:
      - name: configvolume
        secret:
          defaultMode: 420
          secretName: quay-proxysql-config
---
apiVersion: v1
kind: Service
metadata:
  name: proxysql
spec:
  selector:
    quay-component: proxysql
  ports:
  - protocol: TCP
    port: 3306
    targetPort: 3306
```