Quaternary ammonium compounds containing the hydroxyalkyl moiety in the head group have been synthesized. These compounds exhibit a micelle-forming ability, high anticorrosive activity, and antimicrobial action. The compounds of the formula R(CH)N(CHCHCHOH)Br with R = CH-CH are characterized by a protective effect higher than 90-99% at 10 mg/l with respect to hydrogen sulfide corrosion, inhibiting properties against carbon dioxide corrosion (84-98% at 10-25 mg/l), and bactericidal action on sulfate-reducing bacteria (10-50 mg/l).