Cleanup Instructions for old MySQL versions
Introduction
Before installing the new MySQL package which conforms to the binary layout, we have to remove all the old files which were installed by the previous package. If we don't do this, nearly all files of the MySQL server would exist in two versions in two different locations on the harddisk. This would almost certainly cause a lot of strange, hard to solve problems.
Database Dump
This process will erase all of your MySQL data, so if there is currently something in the database which you would like to keep, you have to dump the contents of the database before removing the old version. Take a look at the documentation to the mysqldump utility for more information.
A dump command might look like this:
mysqldump -u root -p --all-databases > mysql-dump.sql
If you don't care about the data in the database, just go ahead without the dump.
Removing the old files
A MySQL installation consists of nearly 900 files in various locations.
Because it is difficult to remove these manually, I created a script which does the work.
NOTE: The script does potentially dangerous things. I have tested it very carefully on my machine and it asks for confirmation several times, but if you use it, you are responsible if it breaks something. If you can't afford to loose something, back up your system first...
Do this to run it:
- Open a terminal window and type in the following commands:
- type
wait for the download to finishcurl -O http://www.entropy.ch/software/macosx/mysql/remove-old-mysql.sh, - type
sudo sh remove-old-mysql.sh, follow the directions on screen
After all files have been removed, you can follow the first-time installation instructions to install the new version of MySQL.
After you did that, you can reload your database dump with something like:
mysql -u root -p < mysql-dump.sql
The exact command might be different in your particular situation, check the docs for more precise instructions.
