We propose a simple and original approach for solving linear-quadratic meanfield stochastic control problems. We study both finite-horizon and infinite-horizon problems, and allow notably some coefficients to be stochastic. Extension to the common noise case is also addressed. Our method is based on a suitable version of the martingale formulation for verification theorems in control theory. The optimal control involves the solution to a system of Riccati ordinary differential equations and to a linear mean-field backward stochastic differential equation; existence and uniqueness conditions are provided for such a system. Finally, we illustrate our results through an application to the production of an exhaustible resource.MSC Classification: 49N10, 49L20, 93E20.1 closed-loop controls. Our approach is simpler in the sense that it does not rely on the notion of derivative in the Wasserstein space, and considers the larger class of open-loop controls. We are able to obtain analytical solutions via the resolution of a system of two Riccati equations and the solution to a linear mean-field backward stochastic differential equation.We first consider linear-quadratic McKean-Vlasov (LQMKV) control problems in finite horizon, where we allow some coefficients to be stochastic. We prove, by means of a weak martingale optimality principle, that there exists, under mild assumption on the coefficients, a unique optimal control, expressed in terms of the solution to a suitable system of Riccati equations and SDEs. We then provide some alternative sets of assumptions for the coefficient. We also show how the results adapt to the case where several independent Brownian motions are present. We also consider problem with common noise: Here, a similar formula holds, now considering conditional expectations. We then study the infinite-horizon case, characterizing the optimal control and the value function. Finally, we propose a detailed application, dealing with an infinitehorizon model of production of an exhaustible resource with a large number of producers and random price process.We remark that in the infinite-horizon case some additional assumptions on the coefficients are required. On the one hand, having a well-defined value function requires a lower bound on the discounting parameter. On the other hand, we here deal with an infinite-horizon SDE, and the existence of a solution is a non-trivial problem. Finally, the admissibility of the optimal control requires a further condition of the discounting coefficient.The literature on McKean-Vlasov control problems is now quite important, and we refer to the recent books by Bensoussan, Frehse and Yam [3] and Carmona and Delarue [5], and the references therein. In this McKean-Vlasov framework, linear-quadratic (LQ) models provide an important class of solvable applications, and have been studied in many papers, including [4,17,10,13,8], however mostly for constant or deterministic coefficients, with the exception of [15] on finite horizon, and [12], which deals with stochastic coeff...