I made this mistake once in my first proper job. It took me 2.5 years to leave a place where I was really unhappy.
So, move on from bad jobs, move on from meh jobs, and be quick about it. Eventually you'll find somewhere you enjoy and you can stick around for a while.
This. Your working career is actually pretty short - for many of us in tech each year is at least 2 percent of your total working life. And hit 40 and it might be 5 percent a year. Do you really want to waste 5 percent of your working life/opportunities/salary doing a job you hate?
So, move on from bad jobs, move on from meh jobs, and be quick about it. Eventually you'll find somewhere you enjoy and you can stick around for a while.