A search is presented for heavy vectorlike quarks (VLQs) that couple only to light quarks in proton-proton collisions at s=8 TeV at the LHC. The data were collected by the CMS experiment during 2012 and correspond to an integrated luminosity of 19.7 fb-1. Both single and pair production of VLQs are considered. The single-production search is performed for down-type VLQs (electric charge of magnitude 1/3), while the pair-production search is sensitive to up-type (charge of magnitude 2/3) and down-type VLQs. Final states with at least one muon or one electron are considered. No significant excess over standard model expectations is observed, and lower limits on the mass of VLQs are derived. The lower limits range from 400 to 1800 GeV, depending on the single-production cross section and the VLQ branching fractions B to W, Z, and Higgs bosons. When considering pair production alone, VLQs with masses below 845 GeV are excluded for B(W)=1.0, and below 685 GeV for B(W)=0.5, B(Z)=B(H)=0.25. The results are more stringent than those previously obtained for single and pair production of VLQs coupled to light quarks.