Found a really useful tip on http://www.linuxbrigade.com for a command to optimize and repair MySQL databases:
mysqlcheck -u root -ppassword --auto-repair --check --optimize --all-databases
Use "p" for password and then your password with no space! I had a corrupt table in a phpBB database and this did the trick. The site seems full of useful tips like this.