An update to a new version of rekordbox will neither erase your music files nor the database.
If you have not yet opened/closed the software more than 3 times, you have the ability to recover the automatic backup of your database from the folder:
/Users/yourusername/Library/Pioneer/rekordbox
Rename datafile.edb to datafile.edb.old
Rename datafile.backup.edb to datafile.edb (removing .backup) - pick the version which seems to be the largest, or is dated before you updated to 4.2.2.
If you have a unique configuration (eg. you have custom-edited your settings file to point to a shared folder), you may need to re-do those customizations.