It should not be surprising that, for a $2$-dimensional manifold, the Gauss curvature $K:M\to\mathbb{R}$ does not determine a unique metric $g$. After all, the former is locally one function of $2$ variables while the latter is locally three functions of $2$ variables. It would be remarkable if $K$ determined $g$, even up to isometry, and, of course, except for constant $K$, it does not, as the arguments of Weinstein and Kulkarni show.
Meanwhile, if one regards the curvature $\mathsf{R}(g)$ of of the Levi-Civita connection of the metric $g$ on a surface $M$ as a section of the rank $3$ bundle $\bigl(T\otimes T^\ast)_0\otimes \Lambda^2(T^\ast)={\frak{sl}}(T)\otimes \Lambda^2(T^\ast)$, then the equation $\mathsf{R}(g) = {\mathsf{R}}_0$ for a given nonzero section ${\mathsf{R}}_0$ of ${\frak{sl}}(T)\otimes \Lambda^2(T^\ast)$ is a determined second-order equation for $g$. (Here, I am writing "$T$" for "$TM$", etc., to save space.) This then becomes a more reasonable question, one that has an easy answer: Namely, if $M$ is compact and connected and $g_1$ and $g_2$ are metrics on $M$ such that $\mathsf{R}(g_1) = \mathsf{R}(g_2)$ and such that these curvature tensors are nowhere vanishing, then $g_2 = c g_1$ for some constant $c>0$, and conversely. The reason for this is simple: If ${\mathsf{R}}_0$ is a nonvanishing section of ${\frak{sl}}(T)\otimes \Lambda^2(T^\ast)$, then requiring that $\mathsf{R}(g) = {\mathsf{R}}_0$ determines the conformal class of $g$ purely algebraically (because using $g$ to 'lower the first index' of ${\mathsf{R}}_0$ has to result in a tensor that is skewsymmetric in the first two indices). Thus, if $\mathsf{R}(g_1) = \mathsf{R}(g_2) = {\mathsf{R}}_0$, where the latter is nonvanishing, then $g_2 = e^u\ g_1$ for some function $u$ on $M$. Plugging this back into the equation $\mathsf{R}(g_1) = \mathsf{R}(g_2)$ and computing shows that $u$ must be harmonic with respect to the conformal structure determined by $g_1$ (which is also the conformal structure determined by $g_2$). If $M$ is compact and connected, then $u$ has to be constant.
As Misha points out, in higher dimensions, the situation is rather different and is well-described in the works of Kulkarni and Yau that he cites. However, just qualitatively, it's worth pointing out that specifying the sectional curvature of a metric is generally a very overdetermined problem in higher dimensions, which is why the rigidity results of Kulkarni and Yau should not be surprising.
To see the nature of this, recall that the Riemann curvature tensor $\mathsf{Rm}(g)$ of a metric $g$ on $M$ is got from $\mathsf{R}(g)$ by 'lowering an index'. By the first Bianchi identity, $\mathsf{Rm}(g)$ is a section of the subbundle ${\mathsf{K}}(T^\ast)\subset {\mathsf{S}}^2\bigl(\Lambda^2(T^\ast)\bigr)$ that is the kernel of the natural map
induced by wedge product
$$
\mathsf{S}^2\bigl(\Lambda^2(T^\ast)\bigr)\to \Lambda^4(T^\ast)
$$
In fact, this map has a natural $\mathrm{GL}(T)$-equivariant right inverse, so that one has a canonical bundle splitting
$$
\mathsf{S}^2\bigl(\Lambda^2(T^\ast)\bigr) = {\mathsf{K}}(T^\ast)\oplus \Lambda^4(T^\ast)
$$
and these two subbundles are $\mathrm{GL}(T)$-irreducible. (I'm using $\mathrm{GL}(T)$ to denote the 'gauge' group of bundle automorphisms of $T = TM$. I don't say that it's great notation, but it will be OK for this discussion.) An important interpretation of this splitting is the following one: Obviously, one can regard a section of $\mathsf{S}^2\bigl(\Lambda^2(T^\ast)\bigr)$ as a quadratic form on the bundle $\Lambda^2(T)$. Then the elements of $\Lambda^4(T^\ast)\subset \mathsf{S}^2\bigl(\Lambda^2(T^\ast)\bigr)$ are exactly the quadratic forms that vanish on all of the decomposable elements in $\Lambda^2(T)$, i.e., the elements of the form $x\wedge y$ for $x,y\in T_xM$ for some $x$. In particular, a section $Q$ of ${\mathsf{K}}(T^\ast)$ is completely determined by its values on the 'cone bundle' $\mathsf{C}\subset \Lambda^2(T)$ that consists of the decomposable elements.
Now, any metric $g$ on $M$ determines a unique section $\Lambda^2(g)$ of ${\mathsf{K}}(T^\ast)$ with the property that
$$
\Lambda^2(g)\bigl(x\wedge y\bigr) = |x\wedge y|^2_g = g(x,x)g(y,y)-g(x,y)^2,
$$
and the sectional curvature of $g$ is simply the function $\sigma_g:\mathsf{Gr}(2,T)\to\mathbb{R}$ defined as the ratio
$$
\sigma_g\bigl([x\wedge y]\bigr)
= \frac{\mathsf{Rm}(g)\bigl(x\wedge y\bigr)}{\Lambda^2(g)\bigl(x\wedge y\bigr)}
\quad\text{for $x,y\in T_xM$ with $x\wedge y\not=0$},
$$
where we regard $\mathsf{Gr}(2,T)$ as the projectivization of the cone bundle $\mathsf{C}$.
The fact that the sectional curvature function is the ratio of two quadratic forms that are sections of $\mathsf{K}(T^\ast)$ shows that it is a very constrained function on $\mathsf{Gr}(2,T)$. In fact, unless the sectional curvature is constant on $\mathsf{Gr}(2,T_x)$, the numerator and denominator of this ratio at $x\in M$ are uniquely determined up to a common multiple. In particular, the set of such functions on $\mathsf{Gr}(2,T)$ can be regarded as the set of sections of a bundle over $M$ whose fibers are isomorphic to a space of dimension $d_n = \tfrac12 n(n{+}1) + \tfrac1{12}n^2(n^2-1) -1$ that is singular along the $1$-dimensional curve of constant functions.
In particular, specifying a candidate sectional curvature function $\sigma:\mathsf{Gr}(2,T)\to\mathbb{R}$ that is not constant on any fiber $\mathsf{Gr}(2,T_x)$ is equivalent to specifying $d_n$ functions of $n$ variables for the $\tfrac12 n(n{+}1)$ coefficients of $g$, which is highly overdetermined when $n>2$. This is why one has the level of rigidity for the sectional curvature that is indicated in Kulkarni's and Yau's results. In fact, as this analysis shows, if $\sigma_{g_1} = \sigma_{g_2} = \sigma$, where $\sigma$ is not constant on any fiber $\mathsf{Gr}(2,T_x)$, then one must have $g_2 = e^u g_1$ for some function $u$ on $M$ and that function $u$ will have to satisfy $\mathsf{Rm}(e^u g_1) = e^{2u} \mathsf{Rm}(g_1)$ which is, itself, a very highly overdetermined second order equation for the single function $u$. (It's kind of remarkable that there are any nonflat metrics $g$ that admit nonzero solutions $u$ to $\mathsf{Rm}(e^u g) = e^{2u} \mathsf{Rm}(g)$ at all, even without the compactness assumption. That is what makes Yau's counterexample in dimension $3$ so interesting. Indeed, though, it turns out that, up to constant scaling and diffeomorphism, there is exactly a $1$-parameter family of such exceptional metrics in dimension $3$, so they are extremely rare indeed. )
The upshot of all these observations is that specifying a nonconstant sectional curvature function $\sigma_g$ in dimensions above $2$ very nearly determines $g$ in all cases, so that, except for a very small set of degenerate cases, the sectional curvature does, indeed, determine the metric. However, it's such an overdetermined problem that this result is not all that surprising.
In particular, specifying $\sigma_g$ is specifying a greater quantity of information about $g$ than specifying, say, $\mathsf{Rm}(g)$. When $n>3$, even specifying $\mathsf{Rm}(g)$ is overdetermined, and, generally speaking, you'd expect $\mathsf{Rm}(g)$ to determine $g$ as well when $n>3$.
When $n=3$, specifying $\mathsf{Rm}(g) = \mathsf{R}$ is locally $6$ second order equations for $6$ unknowns, so it's a determined system. Back in the 80s, by using the Cartan-Kähler theorem, I showed that, when $\mathsf{R}$ is appropriately nondegenerate and real-analytic, the equation $\mathsf{Rm}(g) = \mathsf{R}$ is locally solvable for $g$, and the general solution depends on $5$ functions of $2$ variables. Later, Dennis DeTurck and Deane Yang proved this result in the smooth category as well (see Local existence of smooth metrics with prescribed curvature, in Nonlinear problems in geometry (Mobile, Ala., 1985), 37--43, Contemp. Math., 51, Amer. Math. Soc., Providence, RI, 1986).
In higher dimensions, the natural determined curvature problem is to specify the Ricci tensor $\mathsf{Rc}(g)$ as a section of $S^2(T^\ast)$ (or some trace-modified version of it), and, there, Dennis DeTurck has the best results.