Oxygen is, indeed, highly toxic to cells, due to its oxidizing power, i.e., the ability to remove electrons from another substances. Since the first carbon-reducing organisms started to increase the amount of molecular oxygen in the atmosphere, more than 2 billion years ago, life on earth has been dramatically changed by this compound: you can even consider that aerobic respiration appeared originally as a mechanism of reducing the toxic molecular oxygen to the innocuous water.
Today, organisms that use water to reduce carbon dioxide, releasing oxygen as a by-product, have molecular mechanisms (as aerobic respiration, for instance) to protect them from the very oxygen they produce.
But your question is quite interesting: how did the first photosynthetic organisms protected themselves against the oxygen they started producing?
This is a catch 22. An interesting solution was proposed by a team of geobiologists from Caltech: There was a little amount of molecular oxygen in the ocean's water before the appearance of photosynthesis. This small amount of oxygen was able to promote the evolution of biochemical mechanisms protecting organisms from its toxicity. Some of those organisms, then, were capable to develop photosynthesis and protect themselves against the huge amount of oxygen that they started releasing. According to the team:
Low levels of peroxides and molecular oxygen generated during Archean and earliest Proterozoic non-Snowball glacial intervals could have driven the evolution of oxygen-mediating and -using enzymes and thereby paved the way for the eventual appearance of oxygenic photosynthesis.
Source: Liang, M., Hartman, H., Kopp, R.E., Kirschvink, J.L. and Yung, Y.L. (2006) "Production of hydrogen peroxide in the atmosphere of a snowball earth and the origin of oxygenic photosynthesis", Proceedings of the National Academy of Sciences, 103(50), pp. 18896–18899. doi: 10.1073/pnas.0608839103.
EDIT: according to your comment, all you want to know is "whether cyanobacteria is able to survive oxygen". Well, that's even easier to answer:
Cyanobacteria can perform aerobic respiration. That means that they can easily use protons and electrons obtained from organic matter to reduce molecular oxygen to H2O:
Cyanobacteria... are among the very few groups that can perform oxygenic photosynthesis and respiration simultaneously in the same compartment,and many cyanobacterial species are able to fix nitrogen. Therefore, they can survive and prosper under a wide range of environmental conditions.
Source: Photosynthesis and Respiration in Cyanobacteria