MySQL
MySQL database server.
Host vars:
mysql:
enable: true # required to manage
bind_address: 127.0.0.1 # optional
innodb_buffer_pool_size: 3G # optional
group_concat_max_len: 320000 # optional
sql_mode: "STRICT_TRANS_TABLES,..." # optional
slow_query_log: true # optional, default: false
slow_query_log_file: /var/log/mysql/mysql-slow.log # optional
long_query_time: 2 # optional, seconds
backup_retention_days: 7 # optional
backup_schedule: "0 2 * * *" # optional
version: 8.0 # currently not used by the role
Defaults:
mysql.enable: not set (role does nothing unless defined)mysql.bind_address:127.0.0.1mysql.innodb_buffer_pool_size:3Gmysql.group_concat_max_len:320000mysql.sql_mode:STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTIONmysql.slow_query_log:falsemysql.slow_query_log_file:/var/log/mysql/mysql-slow.logmysql.long_query_time:2(seconds)mysql.backup_retention_days:7mysql.backup_schedule:"0 2 * * *"(daily at 02:00)mysql.root_password: autogenerated on first install and stored in/etc/ploy/password.jsonmysql.version: unused
Notes:
- Uses Percona Server (drop-in MySQL replacement).
- App database user passwords are generated and stored in
/etc/ploy/password.json. - A
backupuser is created automatically with read-only (SELECT) access to all tables. - MySQL backups run as
ployvia/etc/cron.d/ploy-mysql-backupand write to/var/www/<appuser>/backups/<datetime>_<databasename>.sql. - Enable
slow_query_logto log queries that take longer thanlong_query_timeseconds — useful for identifying performance issues.