How to get MySQL time zone?

Under certain circumstances it is relevant to know the timezone in which your date is being stored in a Relational Database System, for example MySQL. One of the easiest ways to know is just by running following command:

Step 1. Login to MySQL

mysql -u root -p

Step 2. Run a “select” query to get the timezone

mysql> SELECT @@global.time_zone;

The output of the previous command should be something like this:

+--------------------+
| @@global.time_zone |
+--------------------+
| SYSTEM             |
+--------------------+
1 row in set (0.00 sec)

As you can see we are getting a SYSTEM value which means that our MySQL instance is using the timezone set in the configuration file: my.cnf.

Would you like to know how to locate your my.cnf file? Then visit: How to find my.cnf MySQL configuration file in Linux?

See you next time!

Alex Arriaga

Añade un Comentario

Leave a Reply

Your email address will not be published. Required fields are marked *