Let $\mathfrak g_1,\mathfrak g_2$ be finite-dimensional real or complex Lie algebras such that ${\rm Der}(\mathfrak g_1)$ and ${\rm Der}(\mathfrak g_2)$ are isomorphic as Lie algebras, where ${\rm Der}(\mathfrak h)$ denotes the algebra of derivations of the Lie algebra $\mathfrak h$.
In that case, is it true that $\mathfrak g_1$ is isomorphic to $\mathfrak g_2$?
I tried to find some reference dealing with that question, but couldn't. Since it's a very simple question to ask, I believe this probably means the answer is 'not necessarily'. However, I was not able to find, or to produce, a counter-example for it either.
If the answer is 'yes', can you sketch the argument or point out some reference for that? If the answer is 'not necessarily', can you describe a counter-example?
The question is very natural and has an earlier counterpart in group theory. If we have two groups $G$ and $H$ such that $\operatorname{Aut}(G)\cong \operatorname{Aut}(H)$, does it follow that $G\cong H$? The answer is negative both for Lie algebras and groups. There are many counterexamples, and it depends on your taste if you find them "somewhat trivial". In any case, the claim is not true.
For groups, a standard example is $$ \operatorname{Aut}(S_3)\cong S_3\cong \operatorname{Aut}(C_2\times C_2), $$ but the symmetric group $S_3$ is not isomorphic to the Kleinian $4$-group $C_2\times C_2$.
For Lie algebras and derivations, the example given by Togo is a standard one (Example $3$ at the end of the paper), which is often cited. But one can easily construct new examples in low dimensions. For example, there are infinitely many solvable complex Lie algebras of dimension $3$, which have only finitely many different derivation algebras. For details see the comments.