1

I was trying to install mysql-server and while trying to set a password I messed up the debian.cnf file and then deleted /etc/mysql hoping that dpkg-reconfigure would recreate it.

Now dpkg-reconfigure is giving an error regarding missing cnf files in /etc/mysql

Tried reinstalling mysql-server itself but the post-install script is giving errors.

I've also tried reinstalling libmysqldev, libmysql20 and mysql-common. No luck.

Which package should I reinstall to create the /etc/mysql and its contents

If I remember correctly the directory contains my.cnf, debian.cnf, conf.d and a couple other files. I'm running Ubuntu 18.04

vishless
  • 145
  • 6
  • I guess this is a duplicate question since https://unix.stackexchange.com/questions/27549/how-can-i-completely-reinstall-mysql?rq=1 has the answer that I'm looking for. – vishless Jun 26 '18 at 02:35
  • You might try running `dpkg -S /etc/mysql` (although this may miss files that are created on the fly by pre/post install scripts, rather than being provided by a package directly) – steeldriver Jun 26 '18 at 02:44

1 Answers1

1

The contents of /etc/mysql are created by mysql-server-5.7’s postinst (replace “5.7” with whichever version you have). You should try running

sudo dpkg-reconfigure mysql-server-5.7

and fixing any errors which occur then.

How can I completely reinstall mysql? explains how to reinstall MySQL completely. Do note however that deleting /var/lib/mysql will delete any database which you’ve created.

Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164