There is a major disadvantage to this method: if the connection is dropped and then reconnects, the new connection will not be authenticated. If you use the URI format, the PHP driver will automatically authenticate the user whenever a new connection is made.
To authenticate with a different database, specify the database name after the hosts. This example will log the user into the "blog" database: