I found both sentences on Google:
So I don't know which one is the correct from. Maybe both?
English Language Learners Stack Exchange is a question and answer site for speakers of other languages learning English. It only takes a minute to sign up.Sign up to join this community
The second is correct and is a phrase that probably every child in the UK has heard whenever they have done something they should not have done or not done something that they should.
It does not really make much sense, but is a kind of cry of exasperation on the part of the person saying it along the lines :"I have told you this a hundred times already, how many more times will I have to tell before you take any notice?"
The second is correct.
Looking at your google links, the first appears in a few contexts. Firstly there is
I don't know how many times I have to tell you...
You can see the phrase is not a complete sentence, but it can work in this statement.
The first phrase sometimes appears as an emulation of speech. The word "do" is unstressed and can become very reduced, especially if the speaker is talking fast, or is angry.
Listening to myself speaking fast, I might say '...times d'I have..." or even '... times 'I have ...". The "do" can be reduced almost to nothing. It seems that to create this effect of rushed, angry speech some writers are omitting the word "do". It is a speech effect, not correct grammar.
A learner should use the form with "do", as omitting it is a grammar error, except as noted above where it is used as a clause instead of a standalone question.