I saw this proof in "Proofs from The Book" by Aigner and Ziegler. The proof is starts with supposing that primes, $\mathbb{P}$, is finite. Pick the greates prime number $p$. Consider the Mersenne number $2^p -1$. Now, assume that $q$ is a prime factor of $2^p -1$.
So since $q \mid 2^p-1$ we can say that $2^p \equiv 1 \pmod q$. Then the order of $2$ in the multiplicative group $\mathbb{Z}_q$ is $p$.
My question is, how can we say that the order of $2$ is $p$? Why is that the order of $2$ is exactly $p$ and not a multiple of $p$?
(The rest of the proof: "Order of any element divides the order of the group, so we conclude that $ \begin{align*} p \mid q-1 \implies p<q \end{align*}$").