2

If I reinstall MySQL, without removing the actual MySQL installation, would it rewrite all files without deleting my databases?

My problem is my mysqld is broken, due to the fact that I accidentally copied a .txt file into it, ie:

#cp -f root.txt /usr/sbin/mysqld

It was a mistake, obviously the daemon wouldn't start anymore, by executing

service mysql start

How can I fix this? I guess I need to reinstall MySQL, but I wonder if I can just reinstall without affecting the databases in my server.

1 Answer 1

3

Normally, no. When re-installing MySQL the existing databases are usually not removed. That's why you may see notes to drop the databases before you uninstall, if you go that way.

However, if you're still unsure, create a backup copy of the contents of the data folder, which will contain all your databases. You'll see a lot of .frm files inside.

Then after you re-install, and by some chance the data folder is empty, drop the contents back in.

2
  • If I delete the /usr/sbin/mysqld file, THEN reinstall mysql, then mysqld will be restored/rewrited?
    – NeoVe
    Jul 8, 2014 at 5:17
  • You should just go for a clean un-install then re-install, because who knows what's really going on at this point. But backup your data folder just in case.
    – random
    Jul 8, 2014 at 5:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.