This paper applies a terminal learning strategy to study distributed quadratic optimization problems. Since the optimal state is unknown in advance, the tracking error information is generally unavailable. To achieve the optimal state without the tracking error information, the terminal consensus iterative learning scheme is used to solve the problem. And the terminal consensus state is obtained without the global information of network. On this basis, the optimal target is also achieved by choosing the proper initial state and learning parameters. And the optimization problem is studied with the constraints of state and control input. Results show that our approach is effective. Compared with existing distributed optimization methods, the learning strategy in this paper provides another effective analysis scheme. Last, a numerical example is presented to show the effective aspects of the method.