#!/bin/sh MYSQLADMIN_CFG="/etc/mysql/mariadb.conf.d/90-mysqladmin.cnf" # generate password PASS=$(perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..16)'); # adjust /etc/mysql/debian.cnf (used as defaults file by system scripts) sed -i "s/^password =.*$/password = ${PASS}/" /etc/mysql/debian.cnf # create config file for mysqladmin itself (maybe not needed) umask 066 cat > ${MYSQLADMIN_CFG} <