Will yum remove mysql-server delete my databases?

9,767

Solution 1

The mysql-server package is designed such that it will not touch user data on either remove or install. The issue you're seeing is probably that you have the i386 package installed and it wants the x86_64 package instead, or vice versa. You will need the full yum output in order to proceed.

Solution 2

If you want to reinstall mysql, note that all your data is in /var/lib/mysql (check your my.conf). Copy all your data to another folder and then do the changes.

You can also check your repos, rearrange them, and install mysql from scratch. It's safer to do all that and be careful next time. So, do two things before the reinstallation:

  • Check the version of your mysql.
  • Copy /var/lib/mysql, for example (as root): cp -R /var/lib/mysql /tmp/mysql.bck

Solution 3

It seems you have different versions of mysql-server being offered by different repos. I'm not sure which one you had running, so I can't tell you which repos to diable. I'm assuming you are running CentOS, but it could be anything with yum.

You can also use repoquery (installed with yum-utils) to check which files your mysql-server package installed and where the databases were located (or find out the initialization script, if that's the way your package installs MySQL).

The next thing, before you do anything else, is to back-up the database files themselves. If you want to have hope of recovering the data, you'll need them.

Once you found out what the exact version of MySQL you were running, installing a fresh box (Amazon's EC2 is your friend) with that exact version and copying the data files over the freshly installed ones may (big if here, and don't do it with MySQL up) allow you do run mysqldump on your database.

As for you original question, I don't think a sane mysql-server package would destroy your installed databases, but I wont bet your data on that.

Good luck.

Share:
9,767

Related videos on Youtube

Talasan Nicholson
Author by

Talasan Nicholson

Updated on September 18, 2022

Comments

  • Talasan Nicholson
    Talasan Nicholson over 1 year

    My MySQL server has broken down, and I can't figure out why. Trying to do a yum reinstall I get this: Error: mysql-server conflicts with mysql-server

    I figure that's because the server already had the mysql server, and when I ran the upgrade, everything got messed up.

    I'm unable to access MySQL, so I can't even do a mysqldump. How can I reinstall without compromising my existing databases?