Double check you are in correct DB

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the databases category.

Last Updated: 2024-03-28

I needed to enter the production DB of a codebase I am maintaining.

I couldn't remember the exact credentials so I used my command-line history to find the command I used last time to enter this database. I remembered it contained some very unmemorable gobbledygook characters and therefore this one seemed to fit:

mysql -h xxxxxxxxxxxxxxx1.chr7pe7iynqr.eu-west-1.rds.amazonaws.com -u xxxxxxxxxxxxxxxx yyyyyyyyyyyyyyyy

After running it, to confirm I was in the right place, I inspected the customers table which I expected to be there. It was. But I saw some other columns, which confused me, so I asked my colleagues about why they were introduction.

After some commotion, it turned out that I had been in the wrong DB. It's very lucky I didn't attempt to do any modifications to this DB!

Lessons