You can also change your gut bacteria through diet, but whether the change is for the good or for the bad is unknown as so little research has been done in this area.
In my own experience, I've switched to eating 95% carnivore over the past several weeks and I can say without hesitation that my mental state has never been better. Stable/elevated moods and low anxiety. I've always thought that was somehow due to elevated ketone production and usage, but I was already burning ketones for energy while eating keto before, yet I didn't feel as good as I do now. I think eating carnivore has changed my gut biome. Certainly there's less bacteria in my gut as there's little material for bacteria to digest anymore. Again, whether this is good for overall health, I don't know. But I've felt enough improvement to continue this rather unusual way of eating.