A few people have advised me to never solder a power cord directly to a PCB, but they couldn't explain why not. Why can/can't I solder it directly?
The insulation on the cable may not be specified for the soldering temperature, and may be damaged.
The insulation is selected for electrical isolation, flexibility and thermal properties. These properties may change if the insulation is taken beyond the storage temperature limits. Damaged insulation may be considered to be non-existent insulation.
The flexibility of the cable will be affected by the soldering, as solder typically wicks some distance up the copper.
The restraint of the cable inside the equipment is typically redundant; a cable gland or clamp, followed by a screw terminal clamp on the copper end. The restraint design depends on the strength of the cable.
The strength of a copper conductor, stranded or solid, is reduced by soldering, as some of the diameter of the copper changes from copper to a copper tin alloy.
The current rating is also affected.
The gasses released by the insulation during soldering may be harmful to the person doing the work.
My opinion is that it is fine to solder directly, as long as the additional risks are compensated for in some way; derating, additional insulation, additional anchoring, and good airflow during soldering.
No great reason not to if you do it properly, lots of kit has power cables soldered to the PCB, both mains & low-voltage. Even stuff that has an IEC socket or similar on the back will have jumper wires to bring the mains to the board.
Several important factors are mentioned in James Cameron's answer, cable strain relief being a major one IMHO. Many of the rest are a bit pedantic as most cables will be fine with being soldered to something - admittedly if you were producing a million mains-powered widgets that had to pass safety certification you'd probably need to demonstrate a bit more care, but in reality for the odd project it'll be fine.
no , solder is soft metal in fault conditions, all wires need mechanical fastning ie so solder to pcb needs wire lugs (which has crimp and solder cup), and stranded wire lose mechanical properties all industry standards dont allow it. and if it was LV circuit you might see manslaughter charges up to 25 year in prison if causing death?