If you’re using 4GoodHosting and you want to change database timestamps, here are some common scenarios and solutions depending on what exactly you’re trying to do:
Â
Scenario 1: Change Timezone of MySQL/MariaDB
To make sure all your timestamps reflect the correct local time (e.g., your timezone):
✅ Solution:
-
Set timezone in MySQL session (temporary):
-
Set default timezone in
my.cnf(server-wide):-
Find and edit the
my.cnffile (you’ll need root access for VPS/Dedicated hosting): -
Restart MySQL service.
-
-
PHP-level timezone setting (if timestamps are from PHP scripts):
 Scenario 2: Update Specific Timestamp Values in a Table
To manually change timestamps in a particular row or column:
✅ Solution:
 Scenario 3: Automatically Use Current Time for Timestamps
To make a column always record the current time:
✅ Solution:
Or if you want it to update on every row change:
Â
Â
 4GoodHosting Shared Hosting Consideration
If you're on shared hosting, you may not have root access to modify my.cnf. In that case:
-
Use
SET time_zoneat the start of your SQL scripts. -
Use PHP's
date_default_timezone_set()before interacting with the database.
Â