Need to cd into the mysql conf directory so that our cnf file structure works without the need for absolute paths. Took the chance to additionally factorize the call to mysql.
Oops, wrong order in var assignment.