The question is in the title. A more precise formulation is:
Let $X$ be a topological space. When does $H^i(X,F) = 0$ for all $i > 0$ and all abelian sheaves $F$ on $X$?
The obvious example is a discrete space. I'd be happy with a characterization of compact Hausdorff topological spaces $X$ satisfying the above property.
Edit: Following Georges Elencwajg's answer, I would like to clarify that these spaces will be quite pathological from the viewpoint of classical topology. Nevertheless, I do not know a single example which does satisfy the above vanishing property and is not discrete. For example, does the Cantor set have this property?