To upgrade mysql using the custombuild script, do the following:
./build set mysql 5.1
./build set mysql_inst yes
./build set mysql_backup yes
Where mysql can be 5.0, 5.1 or 5.5.
A full raw sql backup will be run prior to the upgrade if you have mysql_backup=yes set. It goes without saying, always make backups, either with this tool, or with other means.
After the mysql update, always recompile php.
./build php n