mysql database creation fix

The old database creation code tried to run multiple statements on mysql at once which meant errors in the SQL code weren't always trapped correctly. This branch runs the SQL statements one at a time, allowing for all errors to be caught. It also fixes an ordering problem in one of the SQL files (where a table is referenced as a foreign key before it is created) which was previously ignored (resulting in the table not being created correctly).

This branch has the disadvantage that it makes the warnings from the "DROP TABLE IF EXISTS" statements visible during the install step, but these could easily be filtered with a python warnings filter if needed.