PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, March 17, 2022

[FIXED] Create date wise log of executed queries on MySql

 March 17, 2022     mysql, phpmyadmin     No comments   

Issue

Sometime I make changes on local database but forgot to write/copy query to made changes.

I want to create log file which contain all changes I made in Database with:

 log file with date 
eg. mySql_log_03_10_2019.log

File must created on @ 12:00 AM

Many developers like me may face this problem.


Solution

After searching, I found following ways:

  • Using table
  • Using log file

First run

SET GLOBAL general_log = 'ON';

Then

For table:

SET global log_output = 'table';

For retrieve for particular date:

select * from mysql.general_log WHERE DATE(event_time) = 'yyyy-mm-dd'

For log file:

SET GLOBAL general_log_file = "path to log file";

like. "D:/xampp/mysql/data/logs/mysql_general.log"

Both methods have pros/cons.(table/file size ...)

Hope it help someone.



Answered By - Satish
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing