Wednesday, 2 March 2016

Chane Date & Time CentOS 6.5


 want to set timezone as from UTC to  IST. Use below two commands.



First check date on server :

# date

01. Remove the localtime file.
]# rm -rf /etc/localtime

# ln -s /usr/share/zoneinfo/Asia/Kolkata /etc/localtime

# date

To change time on server :

# date
# date -s "2016 Jan 30 09:10:40"


## To change timezone in MySQL :

2. Check time_zone* tables in mysql db. if they are empty fill them using following command

# mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql

Enter mysql password:
some file will skipeed...  ignore it

3. Again login to mysql:

mysql -u root -p
mysql> select now();

mysql> SET GLOBAL time_zone = "Asia/Calcutta";


OR
mysql> SET GLOBAL time_zone = "Asia/Kolkata";
mysql> select now();
mysql> \q


Ref: http://sandipmore.blogspot.in/2010/03/mysql-timezone-setting-for-ist.html








No comments: