Consider two long coaxial solenoids of length $l$. Let the inner solenoid have $N_1$ turns and radius $r_1$, and the outer solenoid have $N_2$ turns and radius $r_2$.
Let $n_1 = N_1/l$ and $n_2 = N_2/l$ be the number of turns per unit length for the two solenoids respectively.
When a current $I_2$ flows through the outer solenoid, the magnetic field produced inside it is $B_2 = \mu_0 n_2 I_2$.
This magnetic field is uniform and confined to the volume of the inner solenoid.
The magnetic flux linked with each turn of the inner solenoid is $\phi_1 = B_2 A_1 = (\mu_0 n_2 I_2) (\pi r_1^2)$.
The total magnetic flux linked with the inner solenoid having $N_1$ turns is $\Phi_1 = N_1 \phi_1 = N_1 (\mu_0 n_2 I_2) (\pi r_1^2)$.
Substituting $N_1 = n_1 l$, we get $\Phi_1 = (n_1 l) (\mu_0 n_2 I_2) (\pi r_1^2) = \mu_0 n_1 n_2 l \pi r_1^2 I_2$.
By definition, the mutual inductance $M$ is given by $\Phi_1 = M I_2$.
Therefore, $M = \mu_0 n_1 n_2 l \pi r_1^2$ or $M = \frac{\mu_0 N_1 N_2 \pi r_1^2}{l}$.