top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

Get the INSERT statement from one row in Mysql

+3 votes
63 views

I am trying to find a way, how I can look for one row in a table with a search for the id, but then I use this to give me the INSERT statement (which creates this row again)

What I am trying to do, is get an audit where any update - checks the state of a row, saves it as its INSERT statement and saves this to an audit file.

posted Nov 5, 2013 by Seema Siddique

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

From what I know, there is no way to make MySQL generate an insert statement from an existing row. The only way that I know about would be invoking mysqldump.

If you want an audit log, I suggest you better take a look at the binary logs from MySQL, combining automatic backups+binary log you can easily re-assemble the structure of a table/database. Plus, the binary log has everything you want: it logs dates and times, the exact executed queries and you can easily take snapshots from that.

answer Nov 5, 2013 by Anderson
Similar Questions
0 votes

How can I insert data into one table from two other tables where i have three tables namely users, role and userrole.
Now I want to insert the data into userrole table from users table and role table with a single statement.

+5 votes

How can I insert the content of excel file into MySQL Table, any pointer?

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...