Some people have had problems with this part of the quest. It may help to make sure you have no other alcohol in your inventory when you talk to the mayor.
Like Barta said, though, you get more experience fighting the guardian than using the password (and it is an easy fight). Just head to the mines in the Dwarven Halls.
Welcome to the forum.