If you wish to explicitly set the time zone for your MySQL running on an Ubuntu Server, here is how to do it.
First open your global MySQL my.cnf configuration file:
sudo nano /etc/mysql/my.cnf
Scroll down the file to location the [mysqld_safe] section. Add the following line:
timezone = GMT
Obviously you would set it to what you wanted to use, be it UTC, GMT+2 or whatever. Save your changes and restart MySQL:
sudo service mysql restart
Done.
(You can check by creating a table with a timestamp column and then inserting a record with NOW() as the value. This should then show up correctly when queried.)
You might also enjoy:
-
From PHP 5.1 onwards, you have been able to define the default time zone which is to be used in PHP regardless of what time zone the server or Apache might ...
-
To get a list of user accounts on a MySQL server instance, we need to make a SELECT call to the mysql.user table. First, fire up MySQL in your terminal ...
-
MySQL gets installed with a default root account under the username "root". Sometimes the system will allow you to install a root account without a password ...
-
To delete a user account from a MySQL server instance, we need to make use of a DROP USER call to the mysql.user table. First, fire up MySQL in your ter ...
-
To stop a MySQL server instance on an Ubuntu linux install via the command line is as simple as entering: sudo /etc/init.d/mysql stop Alternatively, to st ...