1

I need to compare the results of two mysql dumps from a test db and a dev db. I have seen other questions on here asking similar questions but I need to be able to exclude certain fields such as 'created_at' and 'updated_at'. Has anyone done anything similar and can point me out some tools/resources than could help me out?

All help is appreciated, thank you.

1
  • How big are the databases? If small enough, i would clone them, drop the unneeded columns, dump the data and use a diff tool on the .sql files Commented Sep 18, 2017 at 8:09

2 Answers 2

2

You can use MySQL's mysqldbcompare to compare two databases, which generates a diff-formatted output showing the differences. It doesn't do everything that you stated, so you'll have to take a few additional steps. Mainly:

  1. It doesn't compare two MySQL dump files. Instead, it compares databases. So if you have dump files, you'd need to create a couple of databases temporarily and import your dump files.

  2. As far as I can tell from the documentation, it doesn't allow you to exclude certain fields. So when you parse through the diff, you'd have to manually exclude those. You may be able to pipe it through grep to ignore fields that you're not concerned with.

Sign up to request clarification or add additional context in comments.

Comments

0

To exclude certain fields you just don't include it in the select statement, you can see more at https://www.w3schools.com/php/php_mysql_select.asp

for example SELECT id, firstname, lastname from users won't included created_at and SELECT id, firstname, lastname, created_at FROM users will include created_at field

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.