I'm not sure if this is the right place to post this as I have answered my own question but I'm writing this in the hope that it might save someone else from wasting a whole day, as I have just done.
I'm evaluating Jira and have been trying to set it up with a MySQL database. I kept getting stuck with the "cannot add user, all the user directories are read-only" error when trying to set it up and create the administrator user. I spent the entire day trying all the fixes I could find on-line with no success. I eventually found the following solution that I haven't seen documented anywhere.
I have been following the instructions here https://confluence.atlassian.com/adminjiraserver073/connecting-jira-applications-to-mysql-861253043.html and at step 2.1 there is a link to go to the MySQL website and download the JDBC Connector/J 5.1 http://dev.mysql.com/downloads/connector/j When you go to this link there is a message saying
"MySQL Connector/J 8.0 is highly recommended for use with MySQL Server 8.0, 5.7, 5.6, and 5.5. Please upgrade to MySQL Connector/J 8.0."
I'm using MySQL 5.7 so, foolishly, I believed this and installed JDBC Connector/J 8.0. This led to me getting the "cannot add user, all the user directories are read-only" error during Jira setup when trying to create the administrator user. After trying the solutions from many messages online about this problem with no luck I finally went back to the MySQL website, clicked on "Looking for previous GA versions?" and downloaded and installed the old JDBC connector "Connector/J 5.1.47".
I restarted the Jira service and everything worked perfectly after that.
Windows 7
Jira 7.12.1
MySQL 5.7.22
Java 1.8.0_171