Skip to content

Instantly share code, notes, and snippets.

@lgalaz
Last active October 2, 2018 18:09
Show Gist options
  • Save lgalaz/e122492439572b3c99b375a695dba0af to your computer and use it in GitHub Desktop.
Save lgalaz/e122492439572b3c99b375a695dba0af to your computer and use it in GitHub Desktop.
Check MySQL Logs
Activating mysql logs to see what tables are being used is very helpful when reverse engineering something.
To find your log location run the following
```
SHOW VARIABLES LIKE '%general_log%';
SHOW VARIABLES LIKE '%slow_query_log%';
```
If logs appear off you can turn on with:
```
SET GLOBAL general_log = 'ON';
SET GLOBAL slow_query_log = 'ON';
```
Then
```
$ tail -f -n100 $logLocation // f is to "follow" or keep streaming, n is number of lines.
```
** FLUSH LOGS will close and reopens log files. If you're on Linux, you can use mv to rename log files while they're in use, and then after FLUSH LOGS, MySql would be writing to a new file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment