I have successfully used A tiny bit of epoxy glue.
Another option is a bit of tin soldering wire: give it a couple of tight loops around the end of the cable then squash it with pliers. Tin is soft enough to be defformed around the cable without deforming the cable.
Yet another option is to use an actual soldering iron to cover the very last centimeter of cable with tin. It is quite difficult to solder the end of the already installed cable though.
If the cable is not too badly frayed it can be de-frayed with pliers, grabbing all the strands and twisting it in the right direction. Do it before applying the cap end substitute.