Users Configuration
Overview
Users are configured in the mysql_users table. ProxySQL uses a multi-layer configuration system
where changes require explicit loading and saving commands to take effect and persist.
Key Commands
LOAD MYSQL USERS TO RUNTIME;
SAVE MYSQL USERS TO DISK;
SAVE MYSQL USERS TO MEMORY;
LOAD MYSQL USERS TO MEMORY;
Creating Users
Basic user creation:
INSERT INTO mysql_users (username, password) VALUES ('user1', 'password1');
LOAD MYSQL USERS TO RUNTIME;
SAVE MYSQL USERS TO DISK;
With custom settings:
INSERT INTO mysql_users (username, password, default_hostgroup, default_schema)
VALUES ('user2', 'password2', 10, 'dbtest1');
Key User Properties
| Column | Default | Description |
|---|---|---|
active | 1 | Enables/disables the user |
use_ssl | 0 | Require SSL for connections |
default_hostgroup | 0 | Hostgroup to route traffic to |
default_schema | NULL | Default database schema |
schema_locked | 0 | Restrict user to default schema |
transaction_persistent | 1 | Keep transactions on the same hostgroup |
max_connections | 10000 | Maximum frontend connections |
backend | 1 | Use for backend connections |
frontend | 1 | Use for frontend connections |
Common Configurations
Limit connections per user:
UPDATE mysql_users SET max_connections=100 WHERE username='user2';
LOAD MYSQL USERS TO RUNTIME;
SAVE MYSQL USERS TO DISK;
Enable transaction persistence:
UPDATE mysql_users SET transaction_persistent=1 WHERE username='user2';
LOAD MYSQL USERS TO RUNTIME;
caution
Use hashed passwords rather than cleartext in production. Changes to mysql_users do not take
effect without LOAD MYSQL USERS TO RUNTIME and are not persisted without
SAVE MYSQL USERS TO DISK.