Change the global time zone variable:
SET @@global.time_zone = '+3:00';
QUIT
The variable time_zone can be adjusted directly in the Mysql client console.
Check your current time with the NOW() function before you start playing:
SELECT NOW();
Then change the global time zone variable and disconnect from the server:
SET @@global.time_zone = '+3:00';
QUIT
You need to log out and log back into your Mysql session in order to see the effects.
Once you restart your Mysql session, check the current time again:
SELECT NOW();
If you have the appropriate time zone name database configured, you can refer to the zones by their names. Take an example:
SET time_zone='America/Sao_Paulo';
SELECT @@time_zone;
In order to be able to refer to a time zone name, such as Brazil/Denoronha, you need to be with the timezone name database correctly configured. If you have questions about this subject, or are unable to use zone names, read this article.
To view all valid spindles for Brazil, for example, use the following query:
SELECT * FROM mysql.time_zone_name WHERE Name LIKE '%Brazil%';
See more details in that reply.
Show me what you tried to do...
– durtto
I have nothing, because the system time is correct, if I give echo date("d/m/Y H:i:s") works normal, but my doubt is about SQL itself, how would I do? I wanted to change something inside php admin or php.ini to make this change automatically, so I didn’t need to manipulate the data when inserting.
– Sr. André Baill
You need to explain this one better to searching the server time to add. The question is: This time is not the same as Brazil, because it is on a US server
– durtto
data_record could be used now(), for example.
– durtto
At the time of insertion, I pass the empty field, so that it enters the mysql current_timestamp() already
– Sr. André Baill
mysql doesn’t know the time zone from here, so it puts the time differently
– durtto
And how I manipulate it?
– Sr. André Baill
SUBDATE(now(), INTERVAL 3 hour put this
– durtto
Where would I put it? I don’t quite understand..
– Sr. André Baill
where you put it on the bench, put it
– durtto
Strange you talk about "Brazil time", Brazil has tracks of the territory with 4 different time zones: UTC - 5 hours, UTC - 4 hours, UTC - 3 hours (Brasilia time), UTC - 2 hours.
– anonimo