简体   繁体   中英

How can I get 'max_statement_time' as a global variable in a GCP Cloud Sql mysql 5.6 instance?

As of mysql version 5.7.8, the variable max_statement_time was renamed to max_execution_time . I have an application that checks the database version and sets the correct variable according to that version number.

When I configure my application to use a local mysql installation, everything is fine, but when I configure it to use Google Cloud Sql, it works on 5.7, but fails on 5.6. The error it gives is:

java.sql.SQLException: Unknown system variable 'max_statement_time'

From a mysql shell I ran show variables like 'max%time' and got these results:

  • mysql 5.7 via percona: max_execution_time
  • mysql 5.7 via google max_execution_time
  • mysql 5.6 via percona max_statement_time
  • mysql 5.6 via google [empty]

I see that google has documentation about these flags here but max_statement_time doesn't appear in the list. Is there something I can do to force that flag to appear so that my application can set it an proceed happily?

Cloud SQL is a Google managed service. You do not have access to change all the mysql flags freely. Here there is the list of flags that you can see/ modify. If max_statement_time is not in that list it you cannot do anything related to it.

My recommendation is to use max_execution_time flag instead of max_statement_time . As it is mentioned in the documentation:

For a given flag, Cloud SQL might support a different range than the corresponding MySQL parameter or option.

The flags/ limations are not the same for CloudSQL with a simple MySQL database.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM