The influence of a toroidal magnetic field on the dynamics of shallow water waves in the solar tachocline is studied. A sub-adiabatic temperature gradient in the upper overshoot layer of the tachocline causes significant reduction of surface gravity speed, which leads to trapping of the waves near the equator and to an increase of the Rossby wave period up to the timescale of solar cycles. Dispersion relations of all equatorial magnetohydrodynamic (MHD) shallow water waves are obtained in the upper tachocline conditions and solved analytically and numerically. It is found that the toroidal magnetic field splits equatorial Rossby and Rossby-gravity waves into fast and slow modes. For a reasonable value of reduced gravity, global equatorial fast magneto-Rossby waves (with the spatial scale of equatorial extent) have a periodicity of 11 years, matching the timescale of activity cycles. The solutions are confined around the equator between latitudes 20-40, coinciding with sunspot activity belts. Equatorial slow magneto-Rossby waves have a periodicity of 90-100 yr, resembling the observed long-term modulation of cycle strength, i.e., the Gleissberg cycle. Equatorial magneto-Kelvin and slow magneto-Rossby-gravity waves have the periodicity of 1-2 years and may correspond to observed annual and quasi-biennial oscillations. Equatorial fast magneto-Rossby-gravity and magneto-inertia-gravity waves have periods of hundreds of days and might be responsible for observed Rieger-type periodicity. Consequently, the equatorial MHD shallow water waves in the upper overshoot tachocline may capture all timescales of observed variations in solar activity, but detailed analytical and numerical studies are necessary to make a firm conclusion toward the connection of the waves to the solar dynamo.