Fixed bug setting locality when downloading MySQL database snapshots.
Numerous database and pip bug fixes and refactorings.