$g(x+y)+g(x)g(y)=g(xy)+g(x)+g(y)$ for all $x,y$. Find all functions $g:\mathbb{R}\to\mathbb{R}$ with $g(x+y)+g(x)g(y)=g(xy)+g(x)+g(y)$ for all $x,y$.
I think the solutions are $0, 2, x$. If $g(x)$ is not identically $2$, then $g(0)=0$. I'm trying to show if $g$ is not constant, then $g(1)=1$. I have $g(x+1)=(2-g(1))g(x)+g(1)$. So if $g(1)=1$, we can show inductively that $g(n)=n$ for integer $n$. Maybe then extend to rationals and reals.

Here's a much less murky solution with strong influence from Calvin Lin's excellent answer.
$$
g(x + y) + g(x)g(y) = g(xy) + g(x) + g(y) \tag{0}
$$
First of all, plugging in $y = 1$ gives
$$ g(x + 1) + g(x)g(1) = 2g(x) + g(1)$$
For readability let $g(1) = k$ and we have
$$
g(x + 1) = (2-k)g(x) + k \tag{1}
$$
Plugging in $y + 1$ for $y$ in (0) and reducing with (1):
\begin{align*}
g(x + y + 1) + g(x)g(y+1)
&= g(xy + x) + g(x) + g(y+1) \\
(2-k)g(x + y) + k + g(x) \left[ (2-k)g(y) + k \right]
&= g(xy + x) + g(x) + (2-k)g(y) + k \\
(2-k)\left[g(x + y) + g(x) g(y) - g(x) - g(y)\right] + g(x)
&= g(xy + x)
\end{align*}
Using (0) again we conclude
$$
g(xy + x) = (2-k)g(xy) + g(x)
$$
So as long as $x$ is nonzero, letting $z = xy$ we have
$$
g(z + x) = (2 - g(1))g(z) + g(x) \tag{2}
$$
for all real $x$ and $z$, $x \ne 0$.
From here on out we just work with the much cleaner equation (2).
Setting $z = 0$ gives $(2 - g(1))g(0) = 0$, so either $g(1) = 2$ or $g(0) = 0$.
If $g(1) = 2$, then $g(z + x) = g(x)$ so $g(x) = 2$ everywhere.  Otherwise, $g(0) = 0$, so plug in $z = -x$ to (2):
$$
0 = (2 - g(1))g(-x) + g(x) \implies g(x) = (g(1) - 2) g(-x)
$$
It follows by applying this to $g(--x)$ that $g(x) = (g(1) - 2)^2 g(x)$.  If $g(x)$ is 0 everywhere, this is a solution to the original (0); otherwise, this implies $g(1) - 2 = \pm 1$, so $g(1) = 1$ or $g(1) = 3$.
In the case $g(1) = 1$, $g(z + x) = g(z) + g(x)$.  This implies $g(x) = mx$ for some constant $m$, and $g(1) = 1$ so $g(x) = x$.
In the case $g(1) = 3$, $g(z + x) = -g(z) + g(x)$.  But exchanging $x$ and $z$, $g(z + x) = -g(x) + g(z)$, so $g$ is uniformly 0 (which we already assumed was not the case).
