Corrected the if … elif … else syntax.
Refactored the code to config mysql/maria database root password.