I was trying to install CiviCRM on Wikimedia Australia’s server, and I came across this fun error:
ERROR 1005 (HY000): Can’t create table ‘/tmp/#sql7013_9_0.frm’ (errno: -1)
Turned out, Ubuntu’s AppArmor was breaking the creation of temporary tables in /tmp.
The way around this was to add a new line to the apparmor profile for mysqld
/tmp/** rwk