Your mouse might be connected to the standard mouse connector 1 at the rear of the computer or to a USB connector 2 at either the front or rear of the computer.
Disconnect the failing mouse cable from the computer and connect the new mouse cable to the appropriate connector.