Paddy-upland rotation is an effective agricultural management practice for alleviating soil sickness. However, the effect of varying degrees of flooding on the soil microbial community and crop performance remains unclear. We conducted a pot experiment to determine the effects of two soil water content (SWC) and two flooding durations on the soil microbial community attributes and yield in cucumber. In the pot experiment, cucumber was rotated with cress single (45 days) or double (90 days) under 100 or 80% SWC. Then, the soil microbial were inoculated into sterilized soil to verified the relationship between cucumber growth and microorganisms. The results indicated single cress rotation resulted in a higher cucumber yield than double cress rotation and control. Cress rotation under 80% SWC had higher soil microbial diversity than cress rotation under 100% SWC and control. Flooding duration and SWC led to differences in the structure of soil microbial communities. Under 80% SWC, single cress rotation increased the relative abundance of potentially beneficial microorganisms, including Roseiflexus and Pseudallescheria spp., in cucumber rhizosphere. Under 100% SWC, single cress rotation increased the relative abundance of potentially beneficial bacteria, such as Haliangium spp., and decreased potential pathogenic fungi, such as Fusarium and Monographella spp., compared with double cress rotation and control. Varying degrees of flooding were causing the difference in diversity, structure and composition of soil microbial communities in the cucumber rhizosphere, which have a positive effect on cucumber growth and development.