Same problem here: iPhone 5 not charging.
The following situation happened yesterday and non the of suggestions earlier worked for me. But this one did:
In Malaysia, there are lots of cheap lightning cables sold on the market. They sell around 2 dollars whereas the original costs US$ 15!!! No surprise, I bought a few colorful cables, distributed them around my home, office and car, and it all worked well until I started getting the message not recognizing the new lightning cable. Initially, i thought the 'non-original' cables where the issue. One by one the cables started rejecting and my recently purchased iPhone 5 would not charge.
What happens is this: plugging in the cable leads to the charging sound and it starts charging. After a while you realize its still at 2% and not increasing. When unplugged, it shows the sign 'plug-in' the cable. So it does recognize the charger.
Yesterday, my iPhone scared the **** out of me as it kept on restarting for hours. I saw that on my Galaxy S2 quite often and so got shocked that a premium product from Apple would do the same. I could not believe it.
However, I took my original cable after reading this thread and 'nada' 'niente' nothing. Same as the fake cables. and now even black screen. The iPhone was dead. There was no lint or dust in the charging port of the phone.
Solution:
One reviewer recommended to clean the contacts with something like a spray and I got the idea to use alcohol for the same purpose. We always keep Isoprophyl Alcohol 70% in the house for desinfection here in Malaysia (helps with insect bites). I first cleaned the lighning cable contacts with a small towel. Next I put a very little amount of alcohol into the charging port of the iPhone 5 (like a drop or two). You can see the evaporating in seconds. Then I tried charging the phone after 2-3 minutes and tra-raaaaa and é voilà - it is now back to normal.
Hope this helps.