In this article, we consider the matrix equation $AXB=C$, where A, B, C are given matrices and give new necessary and sufficient conditions for the existence of the diagonal solutions and monomial solutions to this equation. We also present a general form of such solutions. Moreover, we consider the least squares problem $min_X |C-AXB |_F$ where $X$ is a diagonal or monomial matrix. The explici...