There is an infinite number of rational solutions
$$a=\left(\frac{n+1}{n}\right)^n,\;\;b=\left(\frac{n+1}{n}\right)^{n+1},\;\;n\in\mathbb{Z},\;\;0\neq n\neq -1.$$


For a proof that these are *all* the rational solutions of $a^b=b^a$ with $a\neq b$, see <A HREF="https://www.maa.org/sites/default/files/Sved50816668.pdf">Marta Sved's article</A> (1990). As she describes, this question has a long history, it was first answered by Euler in 1748 and has been generalized in various ways. 

I show a screen shot from <A HREF="https://archive.org/details/introductioanaly00eule_0/page/294">Euler's proof</A> that there is an infinite number of rational solutions (Euler uses the word "innumerabilia" -- uncountable, obviously not in the technical sense of the word).

<IMG SRC="https://ilorentz.org/beenakker/MO/Euler_powers2.png"/><IMG SRC="https://ilorentz.org/beenakker/MO/Euler_powers.png"/>