Pulsar timing arrays offer a probe of the low-frequency gravitational wave spectrum (1"100 nHz), which is intimately connected to a number of markers that can uniquely trace the formation and evolution of the Universe. We present the dataset and the results of the timing analysis from the second data release of the European Pulsar Timing Array (EPTA). The dataset contains high-precision pulsar timing data from 25 millisecond pulsars collected with the five largest radio telescopes in Europe, as well as the Large European Array for Pulsars. The dataset forms the foundation for the search for gravitational waves by the EPTA, presented in associated papers. We describe the dataset and present the results of the frequentist and Bayesian pulsar ...