How can I check if my MySQL server is currently running and accessible?

Question

Grade: Education Subject: Support
How can I check if my MySQL server is currently running and accessible?
Asked by:
71 Viewed 71 Answers

Answer (71)

Best Answer
(225)
Use the command `sudo systemctl status mysql` (or `sudo systemctl status mariadb` if you're using MariaDB). If it's not running, the output will indicate 'inactive' or 'failed'. Use `sudo systemctl start mysql` to start it.