The underside of the toilet bowl rim is shady and wet, in short, an ideal place for mildew to grow. That's why you need to regularly clean your toilet bowl with a disinfectant, but even if you do that, you may find it difficult to remove the black or brown discoloration. That could either be because the tank is feeding organisms into the bowl or because the discoloration isn't mold, but mineral deposits.
Video of the Day
Clean With a Disinfectant
Commercial toilet bowl cleaners contain disinfectants that can handle any mildew that can establish itself in the toilet. To clean under the rim, simply squirt the cleaner around the top of the bowl and use a toilet brush to scrub. It's important to first disinfect the brush by immersing it in a 1-to-1 solution of bleach and water. You can also use bleach to clean the toilet, in lieu of a cleaner; just pour a cup into the bowl and swish it around. If, like many people, you find the smell of bleach unpleasant, use a cup of vinegar instead.
Deep Cleaning the Rim
If the mildew has had a long time to grow, you may not be able to get it all off by simply swishing around disinfectant. To handle problem mold and mildew, make a paste using borax and either vinegar or lemon juice and spread it liberally around the underside of the rim; then let it work for several hours. This treatment not only kills mildew and mold, it also dissolves mineral deposits that you may be mistaking for mold. When it's time to rinse off the paste, scrub the underside of the rim with water and a disinfected toilet brush.
Cleaning the Tank
If mildew is a recurrent problem in the bowl, there's a good chance it's also growing in the tank, and that's easy to determine by lifting the lid and looking. If you see black deposits, turn off the water supply, flush the toilet to empty the tank and pour in a cup of vinegar. Swish it around to clean the discoloration, then partially flush to allow some of the mixture to pass through the water holes in the bowl and disinfect them. Repeat the flush every few minutes, letting some of the water out, until the tank is empty; then turn on the water and flush once or twice more.
High humidity in the bathroom contributes to mold and mildew growth in the toilet, and the best way to control that is to provide ventilation. If the toilet is in an alcove, turning on the exhaust fan may not provide enough air circulation around it; you may have to open a door or window. Clean the toilet with a commercial toilet bowl cleaner at least once a week to kill any mildew that may be forming. It's also a good idea to add vinegar to the tank once every two or three months to keep it mildew-free.