Original author: Scott Mitchell; redone by: William Kyngesburye
In progress - 2005-7-10
Last change: 2005/6/19
MySQL version: 4.1.12
dev.mysql.com
This is an easy one to install - just run the installer (install the startup item also).
It's been a while since I first set up mysql, but in recent versions I think it became simpler - all the grant table setup is done by the installer package. All you need to do is secure the initial accounts. Go to dev.mysql.com and look at the documentation, section 2.9.3. Of course to do this you must first start MySQL. Starting with MySQL 4.1.9 that's real easy - use the new prefpane (tho I've had mixed luck with it). Or you can do it the manual way (assuming you installed the StartupItem):
% sudo SystemStarter start MySQLCOM
and enter your Mac admin password. That's for v4.1.x. If you installed 4.0 (why?) make that MySQL
. Or you can just restart your Mac. From now on, whenever you restart, the MySQL server will startup. If you are using the old 3.23, you may not have the startup item, all I can say is - upgrade.
Upgrading MySQL takes a bit more work. If you are updating within a major version (4.0.x or 4.1.x) it's not too hard. Before proceeding, it would be a good idea to backup your MySQL tables - phpMyAdmin or CocoaMySQL can do this for you.
1. Stop mysql. Use the new prefpane starting with 4.1.10 (this asks for your Mac admin user password). (I've had mixed success using the prefpane.) Or the manual way, type in the Terminal:
% /usr/local/mysql/bin/mysqladmin -p shutdown
And enter your mysql root user password (you gave root a password didn't you). Remember, this is the MySQL root user, not the Mac OS root user.
2. Run the new MySQL installer.
3. Copy your data files. You should make sure you have enough free space for the copy. In the Terminal type:
% sudo cp -fpR /usr/local/[old_mysql]/data /usr/local/mysql/
[old_mysql] is the folder name of the mysql version you are updating from. Copy it from the Finder, or do ls /usr/local/
first and copy it from there. Then type your Mac admin password if requested. If you have a lot of data (possible if you have lots of GRASS vector attribute tables), you might want to change that cp
to a mv
so you aren't duplicating all that.
4. Restart MySQL. Again, use the new prefpane (and again, mixed success). Or the manual way, in the Terminal:
% sudo SystemStarter start MySQLCOM
Again, that's MySQL
for v4.0.
You can trash the old mysql folder once you are sure everything is OK (browse a few tables with phpMyAdmin or CocoaMySQL).
However, if you are upgrading to a different major version (3.23 -> 4.x or 4.0 -> 4.1) it's a little different. It involves making a backup dump, then importing that backup into the new version. See the MySQL documentation for more info.
5. Rebuild software that uses MySQL, because the MySQL libraries are static, meaning they are embedded in that software. This includes PHP, GDAL/OGR and GRASS.