When should one rebuild an index?

You can run 'ANALYZE INDEX VALIDATE STRUCTURE' command on the affected indexes; each invocation of this command creates a single row in the INDEX_STATS view. 
This row is overwritten by the next ANALYZE INDEX command, so copy the contents of the view into a local table after each ANALYZE 
The 'badness' of the index can then be judged by the ratio of 'DEL_LF_ROWS' to 'LF_ROWS' 

How to fix: ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)

Open your terminal and type mysql -u root -p Enter your password. Hopefully your MySQL is logged in now.