Changing the hostname

What becomes of the database upon a rebuild? Does it get wiped out? We already have content we’d like to preserve.

Instead of a rebuild, would it be possible to find where the setting is stored and edit it manually?