If I set "$wgDBuser = $wgDBadminuser;" and "$wgDBpassword = $wgDBadminpassword;" (where wgDBadminuser has full database privileges), then rebuildall.php works just fine.
However, if I use a separate wgDBuser which has only SELECT, INSERT, UPDATE and DELETE permissions to the database (as described in http://www.mediawiki.org/wiki/LocalSettings.php#Security), then rebuildall.php fails as follows:
php maintenance/rebuildall.php --conf ./LocalSettings.php
- Rebuilding fulltext search index (if you abort this will break searching; run this script again to fix):
A database error has occurred. Did you forget to run maintenance/update.php after upgrading? See: https://www.mediawiki.org/wiki/Manual:Upgrading#Run_the_update_script
Query: ALTER TABLE searchindex DROP INDEX si_title, DROP INDEX si_text
Error: 1142 ALTER command denied to user '[wgDBuser]'@'localhost' for table 'searchindex' ([MySQLhost])
It seems that if a command to ALTER the DB is required, then it should be using wgDBadminuser rather than wgDBuser.