The effect of resonant magnetic perturbations (RMPs) on high density limit and low-q limit discharges is studied in J-TEXT tokamak. It is found that a moderate amplitude of applied RMPs increases the density limit and delays the disruption, and the disruption precursor is suppressed with a slight reduction in toroidal plasma rotation. A too large amplitude of RMPs, however, leads to a lower density limit and an earlier disruption. For the optimal RMPs amplitude, the disruption is delayed by about 150 ms. For low-q discharges, the applied static RMP can either lower the limit of the edge safety factor q a from 2.15 to nearly 2.0 or sustain stable plasma discharge with q a = 2.1, and the disruptive precursor is also suppressed.