Root-associated soil bacteria can strongly influence plant fitness. DNA methylation is an epigenetic mark important to many fundamental biological processes; however, its roles in plant interactions with beneficial microbes remain elusive. Here, we report that active DNA demethylation in Arabidopsis controls root secretion of myo-inositol and consequently plant growth promotion triggered by Bacillus megaterium strain YC4. Root-secreted myo-inositol is critical for YC4 colonization and preferentially attracts B. megaterium among the examined bacteria species. Active DNA demethylation antagonizes RNA-directed DNA methylation in controlling myo-inositol homeostasis. Importantly, we demonstrate that active DNA demethylation controls myo-inositol-mediated mutualism between YC4 and Solanum lycopersicum, thus suggesting a conserved nature of this epigenetic regulatory mechanism.