Tag Archives: MySQL

How to log all queries on MySQL Server

For software development, finding a bug in your queries can be a complete pain, especially when the symptoms are inconsistent (i.e. it works fine sometimes, randomly fails to return or save data). There are a few different ways to run traces on your SQL queries; SQL Profiler for MSSQL is the best, but for MySQL you can just enable basic logging to a text file by entering the following in your my.ini file.

Be sure to restart the service…. This enables the MySQL General Query Log feature. It’s basically just a text file that MySQL pukes all the queries in-to. There’s no timestamp on them or anything so you’ll have to dig through it using a text-editor to track down the specific query you want though. More info on the MySQL docs site.

Share on Facebook