The phase diagrams of a polar spin-1 Bose gas in a three-dimensional optical lattice with linear and quadratic Zeeman effects both at zero and finite temperatures are obtained within mean-field theory. The phase diagrams can be regrouped to two different parameter regimes depending on the magnitude of the quadratic Zeeman effect Q. For large Q, only a first-order phase transition from the nematic NM phase to the fully magnetic FM phase is found, while in the case of small Q, a first-order phase transition from the nematic phase to the partially magnetic PM phase, plus a second-order phase transition from the PM phase to the FM phase is obtained. If a net magnetization in the system exists, the first-order phase transition causes a coexistence of two phases and phase separation: for large Q, NM and FM phases and for small Q, NM and PM phases. The phase diagrams in terms of net magnetization are also obtained.