Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySql: How to turn on the general query log via my.cnf?

I'm trying to use a program called MySql Administrator, though I'd also be willing to use the Command Prompt (I am on Windows XP). Typically I start MySql via the XAMPP control panel, and I would like to make it so that MySql monitors changes to at least two of my databases. Because I don't make a lot of changes, just keeping a log turned on all the time wouldn't be an issue.

Ideally, I the changes made to the database will be visible via a log file that updates each time a query is made. If that isn't possible, being able to check via MySql Administrator or via the MySql command line would be fine. I'm not sure how to configure MySql to always start with the log on, though. Is that possible? If so, how is it done? Please, tell me the specific location of the files that need to be edited, also. I've been told to edit my my.cnf, but there are many my.cnf-type files in MySql's subdirectories. So, I need to know what specifically to do, without any of the ambiguity....

like image 900
Wolfpack'08 Avatar asked Feb 19 '23 23:02

Wolfpack'08


1 Answers

You can enable it via MySQL Administrator in the settings->logging tab, but I don't think that this actually enables logging. When I turned it on, restarted MySQL, restarted MySQL Administrator, restarted my system, etc., the log file never came up. I edited the my.ini file, in the base MySQL directory. I found the line log= and altered it, also adding a couple lines after:

log = "you_name_it_query.log"
general-log=1
general-log-file = "you_name_it_query.log"

I was then able to browse the general query log via MySQL administrator.

I also used some programs mentioned here: https://superuser.com/questions/443499/detect-and-monitor-changes-to-mysql-database and here: Compare two MySQL databases for my purpose. There are some logging options in some of the programs mentioned by the asker.

like image 154
Wolfpack'08 Avatar answered Feb 23 '23 00:02

Wolfpack'08