In this paper, a novel procedure to design optimal controllers for adaptive optics systems is proposed. The most important feature of this procedure is that it does not require a complex and long tuning procedure like the standard PI controllers and that it is based on real data, i.e. does not require an a priori model for the plant. For this reason, we use system identification methods which, starting from real input-output time series, are able to build a discrete-time equivalent model for the whole plant. Since the plant is Multi-Input Multi-Output (MIMO), the identification methods are the one referred in the literature as Subspace Identification Methods (SID). They provide a state-space model with a deterministic part and a stochastic part. The first one is, in our case, composed by the cascade of the discrete-time approximation of the transfer function of all subsystems, whereas the latter takes into account the measurement errors and, more important, the atmospheric turbulence. In particular the stochastic part does not provide the statistics of the atmosphere, but explains how the wave-front sensor sees the turbulence. The optimal linear-quadratic controller is based on the deterministic part of the identified model and minimizes the variance of the wave-front phase error. Of course, minimizing the error variance is the same as to maximizing the Strehl ratio. Our approach is an extension of the SISO-class controllers, based on the interaction matrix/control matrix, to the dynamical MIMO-class case. In this manner, the dynamical interaction between actuators and sub-apertures is not lost.