What should I do if the computer power supply is not plugged into the socket of the motherboard, and sometimes it will be cut off?

It should be caused by poor pin elasticity of power port due to pin oxidation or frequent plugging and unplugging.

Look at the interface between the motherboard and the power supply to see if the plastic port is yellow (burnt color) due to heating. If so, the internal pin must be oxidized, and the pin or interface needs to be replaced; Look at the power port to see if the shrapnel caliber of some sockets is obviously larger than others. If you have tools, you can pull it tight. The vast majority must be the power supply of desoldering or broken needle.

Please refer to the above processing. If you are too lazy to check, replacing the new power supply directly is the easiest way. Even if the interface is oxidized, the new power supply can be effectively contacted after being plugged in.