Mechanically, we found that MgSO<sub>4</sub> inhibited microglia activation and BBB damage, possibly by suppressing IKK/NF-κB and NLRP3 inflammasome signaling pathways.<h4>Conclusion</h4>Our findings showed that MgSO<sub>4</sub> supplementation played an active role in the prevention and treatment of depression. The gene discussed is NFKB1; the disease is major depressive disorder.