Skip to content

Instantly share code, notes, and snippets.

@dgoguerra
Last active November 22, 2018 08:44
Show Gist options
  • Save dgoguerra/7b1d5422efd8fdc53e95929f9bba4241 to your computer and use it in GitHub Desktop.
Save dgoguerra/7b1d5422efd8fdc53e95929f9bba4241 to your computer and use it in GitHub Desktop.
MySQL general query log

When you have SUPER privileges

# enable query log
SET GLOBAL general_log = 'ON';
SET GLOBAL log_output = 'TABLE';

# disable query log
SET GLOBAL general_log = 'OFF';

In Google Cloud SQL, via gcloud

# enable query log
gcloud sql instances patch DATABASE_ID --project=PROJECT_ID --database-flags general_log=ON,log_output=TABLE

# disable query log
gcloud sql instances patch DATABASE_ID --project=PROJECT_ID --clear-database-flags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment