Measurements of charm mixing parameters from the decay-time-dependent ratio of D0→K+π− to D0→K−π+ rates and the charge-conjugate ratio are reported. The analysis uses data, corresponding to 3 fb−1 of integrated luminosity, from proton-proton collisions at 7 and 8 TeV center-of-mass energies recorded by the LHCb experiment. In the limit of charge-parity (CP ) symmetry, the mixing parameters are determined to be x'2=(5.5±4.9)×10−5, y′=(4.8±1.0)×10−3, and RD=(3.568±0.066)×10−3. Allowing for CP violation, the measurement is performed separately for D0 and D¯¯¯0 mesons yielding AD=(−0.7±1.9)%, for the direct CP-violating asymmetry, and 0.75<|q/p|<1.24 at the 68.3% confidence level, for the parameter describing CP violation in mixing. This is the most precise determination of these parameters from a single experiment and shows no evidence for CP violation.