Upgrading mysql 5.1 to 5.5 on FreeBSD
Hi there! I just completed our upgrade of mysql so I thought I'd let people know how to do it the correct way as I can see alot of people missing some vital steps to have everything running smoothly afterwards. I managed to do the upgrade with 15 seconds of downtime (when you install 5.5 it will shutdown mysql-server so while installing mysql will be offline). 1. The first thing you have to do is check what ports depends on your current version of mys...
I just completed our upgrade of mysql so I thought I'd let people know how to do it the correct way as I can see alot of people missing some vital steps to have everything running smoothly afterwards. I managed to do the upgrade with 15 seconds of downtime (when you install 5.5 it will shutdown mysql-server so while installing mysql will be offline).
1. The first thing you have to do is check what ports depends on your current version of mysql-client, this can be done by issuing
portupgrade -frn mysql-client
if you're using portmaster you obvisously have to change the flags to whatever the portmaster equivalent is, but as im a portupgrade kind of guy I wont get into that. What this command does is that it tries to force rebuild all ports that depends on mysql-client, but as we also used the "n" flag, it wont start doing anything (only a test). So you should now have a huuuuge list of ports that requires the mysql-client port to work correctly, save this list to a safe location because you will need it later (you can remove mysql-client and mysql-server from this list as your going to reinstall those anyway)
2. Now before you start doing anything stupid, after issuing the below stated commands, do NOT restart apache/php-fpm afterwards until you have rebuilt apache/php because you will then get downtime due to that because those softwares will stop working until rebuilt. If you're using postfix for mail, it will stop working at the moment you deinstall mysql51-server, so if you're using postfix for your mailaccounts, you want to rebuild that port the first thing you do in step 3 and then restart postfix.
So start by uninstalling mysql51-client and mysql51-server
Now install mysql 5.5 server (will install mysql 5.5 client automatically)
make install clean
Now that you've got the new shit installed, fire it up and also run mysql_upgrade afterwards
mysql_upgrade -u root -p
After mysql_upgrade is done I usually restart mysql again (just in case)
3. You now have mysql 5.5 installed and running, however, all your software are still using the 5.1 client, so at this point, DO NOT RESTART ANY SOFTWARE. As most software keeps a copy of it's libraries in memory so everything should be working just fine until restart.
If you're running postfix, the first thing you want to do is this
portupgrade -fO postfix
# If your using mysql as userdatabase
portupgrade -fO p5-DBD-mysql
# If your using spamassassin
portupgrade -fO p5-Mail-SpamAssassin
There is probably more p5- ports that you have in your list, rebuild all those and then restart postfix and you should be good to go.
Now, take the list of ports you saved in step 1 and rebuild every single one of them. You probably have alot of php ports in it if you're using php, heres an easy way of getting that stuff rebuilt without problems
portupgrade -fO php5*
# If your also using pecl modules and eaccelerator
# issue the below command
portupgrade -fO pecl* eaccelerator
If you're using apache you probably have apache22, mod_perl and apr1 in the list
portupgrade -fO www/apache22 www/mod_perl2 devel/apr1
The most basic webstuff is now done and it's safe to restart apache, however, you will have to rebuild all ports you have in your list for them to work correctly. So before restarting a software, make sure you have rebuilt that port and those ports that it depends on. When you think your done, meaning you have rebuilt all ports in your list, you can run pkgdb -F to remove all the dependencies to the old mysql-client. After that you can run portversion just to check that there is no dependency warning, if there is no warning, well done!
Thats all from me this time, hope this helped someone out.
- See more at: http://www.203creative.se/blogg/upgrading-mysql-5-1-to-5-5-on-freebsd.html#sthash.xD80sq78.dpuf