That the central extensions of a Lie algebra $\mathfrak{g}$ by $\mathbb{R}$ are in bijection to the cohomology classes
$$ H^2(\mathfrak{g},\mathbb{C}) := \{\theta : \mathfrak{g}\times\mathfrak{g}\to\mathbb{C}\mid \theta([u,v],w) + \theta ([v,w],u) + \theta([w,u],v) = 0 \land \theta(u,v) = -\theta(v,u)\}/{\sim}$$
where
$$ \theta\sim\theta' \iff \exists (b:\mathfrak{g}\to \mathbb{R}): \forall u,v,\in\mathfrak{g} : \theta'(u,v) = \theta(u,v)+b([u,v])$$
is also discussed in this Q&A of mine, where I also show that the reason central extensions are relevant in quantum physics is that the representations relevant to quantum mechanics are actually projective representations, which are classified by unitary representations of central extensions. In general, you can replace $\mathbb{R}$ by any other $\mathfrak{g}$-module and obtain a classification of the extensions by that module instead. Depending on your exact definition of "Lie algebra cohomology" it's more or less hard to see that this $H^2$ is actually the second Lie algebra cohomology, some might take it as its definition.
Now, for the relation to group cohomology, note that the extension
$$ 0\to \mathbb{R}\to \mathfrak{g}' \to \mathfrak{g}\to 0$$
induces an extension of the associated simply connected Lie groups
$$ 1 \to \mathrm{U}(1)\to G' \to G \to 1$$
and $\mathrm{U}(1)$-bundles over $G$ are classified by $H^2(G,\mathbb{Z})$, so we get a bijection between $H^2(G,\mathbb{Z})$ and $H^2(\mathfrak{g},\mathbb{R})$, meaning the "natural" map from the Lie algebra to the Lie group cohomology has as its image precisely the integral cohomology.
Generally, for $H^\bullet(G,\mathbb{R})$ and $H^\bullet(\mathfrak{g},\mathbb{R})$ we get equivalence in all orders by observing that the deRham cohomology of $G$ is the same as equivariant deRham cohomology, but the equivariant forms on $G$ are basically the exterior algebra on $\mathfrak{g}$ since $\mathfrak{g}$ are the equivariant vector fields on $G$, so these two objects are the same. For a bit more detail, see e.g. these notes by Basu.