Theoretical studies suggest that C/O and Mg/Si are the most important elemental ratios in determining the mineralogy of terrestrial planets. The C/O ratio controls the distribution of Si among carbide and oxide species, while Mg/Si gives information about the silicate mineralogy. We present a detailed and uniform study of C, O, Mg and Si abundances for 61 stars with detected planets and 270 stars without detected planets from the homogeneous high-quality unbiased HARPS GTO sample, together with 39 more planet-host stars from other surveys. We determine these important mineralogical ratios and investigate the nature of the possible terrestrial planets that could have formed in those planetary systems. We find mineralogical ratios quite different from those of the Sun, showing that there is a wide variety of planetary systems which are not similar to Solar System. Many of planetary host stars present a Mg/Si value lower than 1, so their planets will have a high Si content to form species such as MgSiO$_{3}$. This type of composition can have important implications for planetary processes like plate tectonics, atmospheric composition or volcanism.