Solution (source code)

= Solution

The zero function is a solution on any interval avoiding $x=0$. For a nonzero solution, the <Bernoulli differential equation> substitution $u=1/y$ gives $u'=-y'/y^2$ and
$$
u'-\frac ux=-x.
$$
An <integrating factor> is $1/x$ on either side of zero. Thus
$$
\left(\frac ux\right)'=-1,\qquad\frac ux=C-x,\qquad u=Cx-x^2.
$$
The full solution set is
$$
\boxed{y(x)=\frac1{Cx-x^2},\qquad\text{or}\qquad y(x)=0.}
$$
Use connected intervals with $x\ne0$ and, in the nonzero family, $Cx-x^2\ne0$. The separate zero solution would be lost by dividing by $y^2$.