The way I learned Lie algebra cohomology in the context of Lie groups was a direct construction: one defines the Chevalley-Eilenberg complex 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, which is similar to the coordinate-free definition of the de Rham differential. Finally, one takes the homology of this 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 is totally unclear 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.
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.