We do it this way because you want to use your credentials with every client tool you use, but you only want to select that specific DB when using the interactive mysql CLI client.
If you put database in the client section, then that'd get activated with other tools like mysqldump as well. You probably don't want that happening without being specifically requested.
This file should be prepared as follows:
touch ~/.my.cnf chmod 0600 ~/.my.cnf
with the following content:
[client] user=yourusername password=yourpassword [mysql] database=theDbYouUseAllTheTime