Monday, August 19

How to change time in mysql database on Redhat linux and CentOS 5&6


It will only work if you are in mysql root user:

[root@mahesh~]# mysql -u root -p "password"  (enter)

Code:

mysql>select now();

+---------------------+
| now()               |
+---------------------+
| 2013-08-10 14:36:02 |
+---------------------+
1 row in set (0.00 sec)

mysql> SET TIMESTAMP=unix_timestamp('2013-08-11 12:34:56'); 

Query OK, 0 rows affected (0.00 sec)

mysql> select now();

+---------------------+
| now()               |
+---------------------+
| 2013-08-11 12:34:56 |
+---------------------+
1 row in set (0.00 sec)

           

No comments:

Post a Comment

:: Linux - Legends ::