Manual:CreateAndPromote.php

Details
createAndPromote.php is a maint-scripts>Special:MyLanguage/Manual:Maintenance scripts|maintenance script that creates a new user and auto-promotes them to sysop and/or bureaucrat status.

There is also an option to promote a user who already exists.