This study is concerned with the synthesis of periodically time-varying memory state-feedback controllers (PTVMSFCs) for discrete-time linear systems. In our preceding studies, we have already established a solid theoretical basis for the LMI-based (robust) H∞-PTVMSFCs synthesis, and the goal of this paper is to extend those results to the H2 performance criterion. In the H2 case, the main difficulty stems from the fact that we have to ensure the existence of common auxiliary variables for multiple LMI conditions that are related to the Lyapunov inequality and inequalities for bounding traces that characterize the H2 norm. We can indeed overcome this difficulty and derive a necessary and sufficient LMI condition for the optimal H2-PTVMSFC synthesis. Based on this result, we also consider robust H2-PTVMSFC synthesis for polytopictype uncertain LTI systems.