Before painting, it's essential to remove all mold and mildew -- which are essentially the same -- from the surface you're going to paint. In most cases, removal isn't all that is necessary; you also have to kill the mold, or it can grow back. Bleach has long been the go-to mold killer, but it isn't necessarily as effective as other household cleaners, including vinegar and borax. Some mildewcides contain additives to make bleach more effective.
Scrub Visible Mold
The first step in the process of mold control is to remove any visible discoloration, and the EPA, OSHA and other federal agencies no longer recommend doing this with bleach. They instead recommend scrubbing with a solution of detergent and water. If you're working outdoors, the water pressure developed by a power washer can substitute for detergent, but to be on the safe side, you should use a unit that automatically mixes detergent into the spray. Keep in mind that this is only one step in the process, though. The discoloration may be gone, but mold can grow back and ruin your paint job if you don't kill it.
Video of the Day
The Need for a Penetrating Disinfectant
The discoloration of a mold colony is just the tip of the iceberg -- it signifies the presence of spores in the wood or painted surface that can grow back. Certain types of paints -- especially alkyd paints containing linseed oil -- are food for some mold species, and they can continue to grow and discolor fresh paint even if you see no evidence of active mold before painting. To prevent mold and mildew growth, you need a mold-killing cleaner that can sink deep into porous surfaces -- and that isn't bleach. The structure of bleach molecules creates a high surface tension that prevents bleach from penetrating.
A Natural Disinfecting Cleaner
Borax is a naturally-occurring mineral that kills mold and remains on the surface to prevent new mold from growing. Mix 1 cup of borax with a gallon of water and scrub the surface, then allow it to dry. There's no need to rinse -- a fine film of borax is insurance against mold growth. To make the disinfecting solution more potent, add a cup of vinegar, which also kills mold. A number of commercial disinfecting products are available for spraying or scrubbing; the use of products that contain bleach should be restricted to non-porous surfaces unless they contain a surfactant to allow the bleach to penetrate.
Primer Before Painting
Allow the surface you're going to paint to dry completely before painting, because any moisture you lock in with a coat of paint can feed the spores you didn't kill -- and there are bound to be some. You should also apply one or two thick coats of an acrylic primer that contains a mildewcide. When painting indoors, choose a latex stain-blocking primer, because it creates a non-porous film that prevents mold from feeding on atmospheric moisture. The thicker the primer coat, the better it can protect, so apply the primer liberally; you might even consider applying two coats.