Back to subject
MySQL/Installing MySQL

Check Your Server Is Alive

Practical lesson

Once MySQL is installed and running, the very first useful habit is confirming it's actually alive and reachable.

SELECT VERSION(); asks the server to report its own version number. If this returns a result, you know two things at once: the server is running, and your client successfully connected to it.

This is a genuinely common real-world step when something goes wrong in a bigger project, "can I even reach the database and get a version back" is often the first thing developers check, before assuming the problem is something more complicated.

Try also running SELECT NOW(); and SELECT CURDATE();. These confirm the server's clock and are useful later when you start working with dates and timestamps in real tables.

None of these three queries read from a table they're asking the server questions about itself, which is a good first check before you start building anything.

Try it yourself
Code

Starter example

Code
SELECT VERSION();
Live preview
+------------+
| VERSION()  |
+------------+
| 8.0.36     |
+------------+
1 row in set