MySQL Schema comparison between PROD and UAT/DEV Servers

 

Hello Folks,

Today I’ll be writing an article on how to do schema comparison of MySQL database between 2 servers(For eg. : PROD and UAT or PROD and DEV).

Let us consider Production server as A and UAT server as B.

Steps are as follows:

  1. Take the dump of all the tables present in Database A
  2. Take the dump of all the tables present in Database B
  3. Compare the above 2 .SQLs files using DIFF command in Unix. You can also use other tools like navicat or Toad edge, here I am using DIFF command on terminal.

While taking dump of the database, make sure you are taking only the schema and not the table data so the command for that will be :

 

The reason being we are taking the dump without data is because we need to compare the schema only.

Once you have the 2 .SQLs file, you can use the DIFF command on the terminal:

 

The -y flag that we are using will show the difference beside each other and it will be easy to compare the files.

Leave a Reply

Your email address will not be published. Required fields are marked *