Start with
[tex]\dfrac{dy}{dx}=\dfrac{\sin(x)}{y}[/tex]
Separate the variables:
[tex]y\;dy = \sin(x)\;dx[/tex]
Integrate both parts:
[tex]\displaystyle \int y\;dy = \int\sin(x)\;dx[/tex]
Which implies
[tex]\dfrac{y^2}{2} = -\cos(x)+c[/tex]
Solving for y:
[tex]y = \sqrt{-2\cos(x)+c}[/tex]
Fix the additive constant imposing the condition:
[tex]y(0) = \sqrt{-2+c}=2 \iff -2+c=4 \iff c=6[/tex]
So, the solution is
[tex]y(x) = \sqrt{-2\cos(x)+6}[/tex]