I have a managed MySQL instance on GCP. Where would I find a query log? Is this something I need to enable first somewhere? I have read their documentation ( https://cloud.google.com/sql/docs/mysql/how-to ) and didn't find it helpful on this topic.

  • I've not used MySQL on GCP, but if you can run the mysql client (which you have to be able to do - no?) run SHOW VARIABLES LIKE %log% or similar and that should point you to any logs you have that are operational. p.s. welcome to the forum!:-)
    – Vérace
    Apr 18, 2019 at 19:18

1 Answer 1


It's all documented here and here.

Relevant part:

To make your general or slow query logs available, enable the corresponding flag and set the log_output flag to FILE. This makes the log output available using the Logs Viewer in the Google Cloud Platform Console. Note that Stackdriver logging charges apply.

If log_output is set to NONE, you will not be able to access the logs. If you set log_output to TABLE, the log output is placed in a table in your database. If this table becomes large, it can affect instance restart time or cause the instance to lose its SLA coverage; for this reason, the TABLE option is not recommended. If needed, you can truncate your log tables by using the API. For more information, see the instances.truncateLog reference page.

  • Thank you - ours is set to FILE, working on getting permissions to view logs in Stackdriver now! Apr 18, 2019 at 19:47
  • After setting this up, I am only able to view error and activity logs - not query logs. Any more tips? Apr 23, 2019 at 13:38
  • Is slow_query_log set to on ?
    – Philᵀᴹ
    Apr 23, 2019 at 14:28
  • Yes, but I am interested in ALL queries, not just the slow ones... the slow queries portion is working OK. Apr 23, 2019 at 14:36
  • 2
    Is general_log set?
    – Philᵀᴹ
    Apr 23, 2019 at 14:46

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.