It has to be replaced ideally in whole, from the point it starts inside the mouse (with a white 4-5 piece of wires connection) to the end (of the USB connector to the computer) or at least to a considerable length because there is fatigue very near the mouse and the more I fix it there with soldering the closer it gets to being unfixable or reaching towards 'inside' the mouse where fixing it will be hard or impossible. So I wonder if there is a way to get a replacement of the whole thing or at least the inside-the-mouse connector to a certain length. Also I wonder if other mice types are identical in the connector of the inside.
I am in the process of doing this myself. I removed the wire entirely by taking apart the mouse and disconnecting the 5-pin plug inside (this was VERY difficult, as I was unable to figure out how to remove the circuit board above the plug, plus it has a post next to the plug, which hampers removal - poor engineering, guys!).
BE CAREFUL when looking for a replacement cord. Most of the USB/5-wire Logitech cables have plugs which are close to the same size as the USB connector. The plug inside the G500 is much smaller. I did not notice this until the replacement cable arrived (was not SPECIFICALLY for a G500), but I only spent about $6-7. My plan now is to cut off the small plug from the bad cord (leaving a few inches of wire) and do the same to the new cord, solder the old plug to the new cord, reassemble and pray it works.
If I find an actual replacement cord, I'll post again.
I also did the same as the first answer but I had better luck removing the cable. I found that if you take out the whole circuit board you can then access the 5 pin plug with ease because the post is no longer in your way.
I am now in the process of trying to find either a replacement cable or solder on to a new USB cable.
I will also look for a replacement cord and post if I find one.
If I don't post I problem just solder on a new USB cord.