The dataset reports on the light-induced realignment of electric polarization in a ferroelectric nematic liquid crystal confined between indium tin oxide (ITO) electrodes. The data and findings are described in the manuscript "Realignment of ferroelectric nematic by photoinduced electric field" submitted to Science Advances.