I recently ran into an issue renaming my SharePoint 2010 VM's hostname. Since it was a development VM running SharePoint 2010 & SQL Server 2008, the SQL Server was unavailable.
- Use the Rename-SPServer powershell command. View Technet Link .
- E.g. Rename-SPServer -Identity <OldName> -Name <NewName>
- If the SQL DB is on the same server, when accessing the central admin you may run into "Cannot connect to the configuration Database", after renaming the host. To fix this add an alias for the SQL Server using the CliConfg.exe . More info here
- Update the alternate access mapping URLs under the central admin
- Update any entries under C:\Windows\System32\drivers\etc\hosts .
- iisreset
And everything is good as new!