Parsing DATABASE_URI, use URI#hostname: it's smarter about IPv6

Fixes #15705.

Conflicts:
	activerecord/CHANGELOG.md
	activerecord/test/cases/connection_adapters/merge_and_resolve_default_url_config_test.rb