0

If I exec a db.exec("set time_zone = "+00:00""), the status time_zone of connection to exec the SQL will change and will the connection be put back to the pool?

If so, will it be reused by another processor who doesn't know the status of connection has been changed?

1 Answer 1

1

The correct way is to set a timezone in the connection string:

sql.Open("mysql", "root@tcp(127.0.0.1:3306)/dbname?charset=utf8&parseTime=true&time_zone=%2B00%3A00")

Note that time_zone value must be urlencoded. Also you can set other system variables in conn string.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.