- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How do I set the timezone of MySQL?
152 Lectures 16 hours
87 Lectures 5.5 hours
To know the current time, we can use the now() function with SELECT statement. The query is as follows −
mysql> SELECT now();
After executing the above query, we will get the current time. The following is the output −
+---------------------+ | now() | +---------------------+ | 2018-10-06 12:57:25 | +---------------------+ 1 row in set (0.02 sec)
To set the time zone, we can use the command SET. The syntax is as follows −
mysql> SET time_zone = "Some value";
Now I am applying the above query to set the time zone. The query is as follows −
mysql> SET time_zone = "+9:50"; Query OK, 0 rows affected (0.00 sec)
We can set globally as well with the help of SET command −
mysql> set global time_zone="+9:00"; Query OK, 0 rows affected (0.00 sec)
- How do I print a Python datetime in the local timezone?
- How do I find out the default server character set in MySQL?
- How do I set the default value for a column in MySQL?
- How to change MySQL timezone?
- How do I set the size of a list in Java?
- How do I set the Selenium webdriver get timeout?
- How do I get the current time zone of MySQL?
- How do I use the @ sign in MySQL?
- How do I get the creation date of a MySQL table?
- How do I clone the structure of a table in MySQL?
- How do I generate days from the range of dates in MySQL?
- How do I SELECT none of the rows and columns in MySQL?
- How can I view the indexes I have set up in MySQL?
- How do I remove a MySQL database?
- How do I lag columns in MySQL?