By harmful bacteria, we generally mean pathogenic bacteria. In general, bacteria are harmful, helpful or neutral. The harmful bacteria can cause medical issues such as diseases. The control of harmful bacteria depends on the medium they are in, their location and also on what potential harm they can do. For example, when discussing drinking water, harmful bacteria can cause disease if we drink water contaminated with these bacteria. We control such bacteria in our water by disinfecting it with chlorine, ultra violet rays, ozone or by boiling it, etc. When talking about bacteria that attach to the surface of metals and eat them (an example is bio-fouling of ships), we use anti-adhesion coating to prevent bacterial attachment to surfaces. For harmful bacteria found in food, we heat the food to kill them or freeze the food to make them inactive. When we are sick due to these bacteria, we use medication to kill any pathogen in our body.
Hope this helps.