The way I learned Lie algebra cohomology in the context of Lie groups was a direct construction: one defines the Chevalley-Eilenberg complex with coefficients in a vector space $V$ (we assume the real case) as $$C^p(\mathfrak g; V) := \operatorname{Hom}(\bigwedge^p \mathfrak g, V)$$ and explicitly defines the boundary map $\delta^p: C^p(\mathfrak g; V) \to C^{p+1}(\mathfrak g; V)$ by a formula similar to the coordinate-free definition of the de Rham differential. Finally, one takes the homology of this cochain complex. With this approach, the connection between the Chevalley-Eilenberg cohomology and the left-invariant de Rham cohomology is obvious. This was roughly the approach used by Chevalley and Eilenberg themselves
However, Wikipedia and some other sources rather define $$H^n(\mathfrak g; V) = \operatorname{Ext}^n_{U(\mathfrak g)}(\mathbb R, V)$$ where one constructs so-called universal enveloping algebra $U(\mathfrak{g})$, whose motivation isn't clear to me, even though I understand the formal definition. Even when one knows what a derived functor is (which I do), this definition still requires a lot of work, such as the introduction of the universal enveloping algebra, finding the projective resolutions, etc.
At first I thought that the $\operatorname{Ext}$ approach might just be abstract restatement of the same procedure that we carry out while defining the cohomology through the Chevalley-Eilenberg complex, but I don't really see why it should be that way. Well, we take homology of the $\operatorname{Hom}$ complex, but it's where the analogy seems to end because of this universal enveloping algebra, which doesn't have a clear counterpart in the explicit construction.
Is there any advantage to use the second definition of the Lie algebra cohomology? The only reason I could see is the derived functor LES, but it would probably be much easier to show it directly. There's also a clear analogy with the group cohomology defined that way - one just takes the group ring $\mathbb Z[G]$ instead of the universal enveloping algebra $U(\mathfrak{g})$, but group cohomology isn't hard to construct explicitly and the derived functor definition seems so abstract that it's useless.
Maybe my confusion stems from the fact that I learned homological algebra separately in a very abstract setting, roughly following Weibel's book, and while I understood the definitions I don't think I understood the motivations and the big ideas. I asked a similar question on Math.SE, but now I realized that MO is a better place to ask.