I made the fatal error of copying and pasting a sudo command into my terminal without double checking it, here it is.
sudo -R mysql /
What this does (for those that don't know) is recursively change the owner every file from the root down to mysql!! obviously not what i was intending
This has of course played havoc with my system, the first thing i did was the apple permission repair but that only works for files that it has an idea of though it has changed a lot of file ownerships back to root. It seems that many library files are still owned incorrectly, as a lot of problems don't work. What i propose doing as a temporary fix until i can reinstall mountain lion is to recursively set all ownerships that are mysql to Luke. I'm not sure what they should precisely but this is still better than nothing. Is this possible using a shell script?
I realise that this won't fix the problem properly and i will have to reformat but i need the machine in a workable state just for this week.