dt.iki.fi

Restoring Mimetype Associations

I deliberately deleted all mime*.* files I could find in

~/.local/share/applications
/usr/share/applications
~/.config

I might also have deleted /usr/share/mime/mime.cache.
I definitely deleted the directory ~/.local/share/mime (it seemed to contain stuff only related to WINE).

I was hoping to fix some trouble with identifying mimetypes for files but it just left me with all mimetype associations gone. No default applications to open anything.

The fix is simple once you know it:

sudo update-desktop-database

This will restore /usr/share/applications/mimeinfo.cache, so all your files are opened with their defualt applications again.
Customising this will create or modify ~/.config/mimeapps.list.
All other mime*.* files under your $HOME are deprecated I believe.