Andy…
That’s a very good decision.
BTW… from what you said about the techie guy, it is clear that running the upgrade is beyond him. It’s quite involved… best done in stages – with a series of tests. Also requires knowing shell command line. Although I have been told there is a way to do it using phpMyAdmin.
Given his complete lack of knowledge. Not sure he wold have handled this – assuming mySQL 5 is ready to go on your server:
Upgrading from MySQL 3.23 to MySQL 5, to avoid compatibility issues it is best to upgrade to MySQL 4.0 first as a stepping stone.
Bear in mind that after you have upgraded, you should use the files and directories associcated with the new version of MySQL. If, for example, you move from 3.23 to 5.0, rather than using /usr/bin/mysql you would need to use /opt/mysql-5.0/bin/mysql.
Overview
The upgrade process in outline is broadly the same across versions (file and directory paths do vary though, so take care).
1. Stop the old MySQL (edit rc.conf and reboot)
2. Backup (copy the directory)
3. Rename the data directory
4. Start the new MySQL (edit rc.conf and reboot)
5. Run the new version’s upgrade commands
6. Confirm that the database is functioning properly
7. Remove the backup
Step by step from 3.23 -> 4.0
The first thing you will need to do is backup the existing data.
Disable the existing MySQL installation. Open the /usr/local/etc/rc.conf file, and locate the following line:
mysql_enable=”YES”
Change it to read:
mysql_enable=”NO”
Reboot server. MySQL is now not currently running, so the data on disc is in a consistent state.
Copy the database directory:
cp -a /usr/local/var/lib/mysql /usr/local/var/lib/mysql.v3.backup
Move the database directory:
mv /usr/local/var/lib/mysql /usr/local/var/lib/mysql-4.0
Change /usr/local/etc/rc.conf to read:
mysql_enable=”YES”
mysql_version=”4.0″
Once you’ve made this change, reboot the server. You’ll now be running MySQL 4.0 rather than the original 3.23 version.
There are still some changes to be made to enable the system to work correctly.
Firstly you will need to upgrade the MySQL privilege table. This is achieved by typing at the shell:
/opt/mysql-4.0/bin/mysql_fix_privilege_tables <password>
Substitute your MySQL administrator’s password for <password>.
Some existing databases may also need to be upgraded to new table types. You can achieve this by using the command:
/opt/mysql-4.0/bin/mysql_convert_table_format <databasename>
Running this command for each of your databases will upgrade them to the new table format.
Once you are happy that MySQL 4 is working correctly you can remove the backed up data (unless you are moving to MySQL 5 by way of MySQL 4, in which case you may wish to keep the backups until you have completed the entire process).
rm -rf /usr/local/var/lib/mysql.v3.backup
4.1 and beyond
The upgrade from MYSQL 4.0 to MySQL 4.1 and above follows the same basic outline , just the file/directory paths vary.
E.g. /opt/mysql-4.0/bin/ becomes /opt/mysql-4.1/bin/ or /usr/local/var/lib/mysql-4.0/ becomes /usr/local/var/lib/mysql-5.0/.
So from MySQL 4.0 to MySQL 5.0:
Edit /usr/local/etc/rc.conf:
mysql_enable=”YES”
to:
mysql_enable=”NO”
Reboot:
reboot server
Backup:
cp -a /usr/local/var/lib/mysql-4.0 /usr/local/var/lib/mysql.v4.0.backup
Rename:
mv /usr/local/var/lib/mysql-4.0 /usr/local/var/lib/mysql-5.0
Edit /usr/local/etc/rc.conf:
mysql_enable=”YES”
mysql_version=”5.0″
Reboot:
rebootv server
Run upgrade command
/opt/mysql-5.0/bin/mysql_upgrade –datadir=/usr/local/var/lib/mysql-5.0 <password>
Once you are happy that MySQL 5 is working correctly:
rm -rf /usr/local/var/lib/mysql.v4.0.backup