The recently developed method combining the configuration interaction and the coupled-cluster method was demonstrated to provide accurate treatment of correlation corrections in divalent atomic systems [M.S.Safronova, M.G.Kozlov, and C.W.Clark, Phys. Rev. Lett. 107, 143006 (2011)]. We have extended this approach to the calculation of quadrupole polarizabilities alpha_2 and applied it to evaluate alpha_2 for the ground state of Mg and Mg-like Si^{2+}. Performing the calculations in three different approximations of increasing accuracy allowed us to place the upper bounds on the uncertainty of the final results. The recommended values alpha_2(3s^2 1S0)= 35.86(13) a.u. for Si^{2+} and alpha_2(3s^2 1S0)= 814(3) a.u. for Mg are estimated to be accurate to 0.37%. Differences in quadrupole polarizability contributions in neutral Mg and Si^{2+} ion are discussed.