We can prove that any group $G$ of order $p^2$ is abelian.
If $|Z(G)|=p^2$, then done. If $|Z(G)|=p$, then $G/Z(G)=p$ and so $G/Z(G)$ is cyclic. Suppose $hZ(G) (h\in G,h\
otin Z(G))$ is the generator of $G/Z(G)$. Then for any $g_1,g_2\in G$, there is $g_1=h^nz_1, g_2=h^mz_2$, where $z_1,z_2\in Z(G)$. Thus $$ g_1g_2=h^nz_1h^mz_2=h^nh^mz_1z_2=h^mz_2h^nz_1=g_2g_1 $$