I would try anchoring the cord to the keyboard, leaving a couple inches of slack between the anchor point and the micro USB plug.
Any pulling on the cord will stop at this point, instead of continuing to the plug and disconnecting it from the jack. Also, the cord can still be unplugged (allowing something else to be plugged into the port) while remaining anchored.
Possible methods of anchoring the cord with a bit of slack at the micro USB end could be:
1) A Strip of strong tape, holding a couple of inches of the cord's length to the back panel.
2) Glue, used in a similar fashion as the tape, would also work. A glue that is flexible after drying (much like the tape is flexible) will "give" a little and still hold. A hard, brittle adhesive might crack and release the cord.
Having a good length of the cord held by either of the materials will hold better than anchoring at a single point, since the stress will be transferred from the cord (and absorbed by) a greater amount of surface area of the materials being held, and to the glue/tape itself.
-If the tape is wide enough to come over top and bottom of the keyboard it will help even more with holding the cord.
-Glue should be applied thick enough to completely surround and embed the cord, since it is holding onto both the cord and the keyboard's case, while absorbing any stress on the cord.
I Have used "Gorilla" brand tape or silicone-based glues for this type of cord anchor several times, and it has worked great for years on most occasions.
Another option is a mechanical anchor of some sort, such as a wire clamp, or zip-type cable tie screwed-in to the keyboard.
The tape solution is more temporary than the others; but I can't really see why the cord isn't permanently affixed in the first place, unless a different length was sometimes needed.
If it were my keyboard, I would use a permanent anchor.