I want to prove that in a group of order $pq^2$, if $p$ divides $|Z(G)|$, then $G$ is abelian.
I know that in this case, the order of $G/Z(G)$ must be $q^2$.
If $G/Z(G)\simeq \mathbb{Z}/{q^2}\mathbb{Z}$, then we are done, because $\mathbb{Z}/{q^2}\mathbb{Z}$ is cyclic.
But what happens if $G/Z(G)\simeq \mathbb{Z}/{q}\mathbb{Z}\times \mathbb{Z}/{q}\mathbb{Z}$? I think I'm missing something trivial..