Looks like just cheap general purpose construction grade adhesive. It is unimportant that you replicate that, could buy construction adhesive from a hardware store, or you could get latex/acrylic or silicone caulking, but generally speaking the typical construction grade silicone is acidic and you don't want acid cure caulking for electronics because the acid in it degrades metal/electrical.
There are some automotive (among other industries) sealants spec'd as "sensor safe" or "electronics" or "non-corrosive" that aren't acid cure, but frankly in this application just about anything would work, for example thick wood glue, or epoxy, or hot glue.
Does this connector also have screws or friction tabs or something, or is this adhesive the only thing holding it in? If it is the only thing holding it then I would get a replacement socket that does have screw-down mounting ears instead of screwless, and depending on how well it attaches, maybe not put any goop on it at all unless there are big gaps.