We report measurements of charm-mixing parameters based on the decay-time-dependent ratio of D0→K+π- to D0→K-π+ rates. The analysis uses a data sample of proton-proton collisions corresponding to an integrated luminosity of 5.0 fb-1 recorded by the LHCb experiment from 2011 through 2016. Assuming charge-parity (CP) symmetry, the mixing parameters are determined to be x′2=(3.9±2.7)×10-5, y′=(5.28±0.52)×10-3, and RD=(3.454±0.031)×10-3. Without this assumption, the measurement is performed separately for D0 and D0 mesons, yielding a direct CP-violating asymmetry AD=(-0.1±9.1)×10-3, and magnitude of the ratio of mixing parameters 1.00<|q/p|<1.35 at the 68.3% confidence level. All results include statistical and systematic uncertainties and improve significantly upon previous single-measurement determinations. No evidence for CP violation in charm mixing is observed.