Fastened mate: Click 'fastened mate'. Then, click the side face of the axle and the corresponding face inside the gear. See the visual to the right.
Planar mate: Click 'planar mate'. Then, click a side face of the axle and the corresponding face inside the gear. Repeat this for at least one more side of the axle.
If the assembly doesn't look quite right after using a mate, try flipping the primary axis or reorienting the secondary axis (these actions are found on the mate options).