It could be related to my previous question here.

Let $\mathcal F$ be a sheaf on a topological space $X$. Hartshorne in his book on Algebraic geometry defines the sheaf cohomology by $$ H^i(X, \mathcal F)= R^i\Gamma(X,-)(\mathcal F)$$

Alternatively in some other literature (like this) one defines the sheaf cohomology for a *coherent sheaf* $\mathcal E$ by putting $$H^i( X, \mathcal E) = \mathrm{Ext}^i( \mathcal O_X, \mathcal E) \equiv \mathrm{Hom}_{D^b(\mathrm {Coh}(X))} (\mathcal O_X, \mathcal E[i])$$ in the setting of derived category of $X$.

How to relate these seemingly two different definitions of sheaf cohomology agree? Notice that the latter definition only applies for coherent sheaves, so can I say the first definition of sheaf cohomology is better? Can I rewrite the first definition using the derived category?