Chosen Solution

I need to know how to replace the cable or repair it.

If it is an USB cable that was cut then you should open your keyboard and re-solder a new cable to the PCB. Please mind to properly connect polarity of the USB power supply and Data cables. It will be 4 wires + ground so if you are handy with soldering iron then you should handle with it.

then finish your %#*@ teardown and fix it while your doing it