It happens with everyone in every organization or institute. Even if you change your job, it's not certain you may not end up in the same situation. Worst of all, it affects only you and your personal life.
Here are my personal suggestions to handle the situation:
1. Firstly, take nothing personally. It's only a job. Try to modify your behavioral aspects - the way you react to things related to your job. (Develop a thick skin or become more diplomatic). Be cautious - never discuss your weaknesses or things in the office that affect you mentally. It may be used against you or as leverage.
2. Try to develop personal relationships with a few colleagues close to your boss or even with your boss. Do nothing wrong, but keep track of their work and schedules, especially their priorities.
3. Try to gather information on how other employees were treated in the office before you joined. Learn about office politics, who's who, who likes what, dislikes what, who is close to top management, etc., so you know what to discuss or avoid in front of certain individuals.
4. Stay informed about office occurrences such as upcoming events, projects, and management priorities, and align your work accordingly.
5. Avoid complaining - consider leaving if necessary. Complaining about your boss or colleagues won't improve your situation in the office. At worst, someone may take it personally and worsen the situation.
Here are a few strategies to consider:
1. When assigned work, assure your boss that you will prioritize it, but also approach them 2-3 times to address any issues with the tasks given (even if you don't need help). This process satisfies your boss's ego. Additionally, when you submit completed work, there are fewer chances of mistakes being found.
2. Understand the strengths and weaknesses of your team members. Involve at least 1-2 colleagues in your work and inform your boss about the assistance you received from them. This way, if there are any errors in the work, you won't be solely responsible.
3. Occasionally offer help to your boss (not too frequently) on tasks they are working on. This shows initiative and increases their reliance on you. Furthermore, you gain insight into your boss's responsibilities.
There is much more to learn, understand, and practice. Take these steps, and hopefully, they will help you.