Linux: how to restore config file using apt-get/aptitude?

I've occasionally lost my config file "/etc/mysql/my.cnf", and want to restore it. The file belongs to package mysql-common which is needed for some vital functionality so I can't just purge && install it: the dependencies would be also uninstalled (or if I can ignore them temporarily, they won't be working).

Is there a way to restore the config file from a package without un-ar-ing the package file?

dpkg-reconfigure mysql-common did not restore it.


dpkg -i --force-confmiss mysql-common.deb will recreate any missing configuration files, ie /etc/mysql/my.cnf in your case.


None of the above worked for me - maybe outdated - anyway, I found this solution:

apt-get -o Dpkg::Options::="--force-confmiss" install --reinstall mysql-common