![]() |
| |||||||
|
This week's tips show you how to install and set up the MySQL Database server, and how to integrate it with the Apache-PHP module. We'll look at installing the latest stable release of MySQL - 5.0. First, download the binary distribution from MySQL. Choose the appropriate Mac OS X Binary - 10.3 (Power PC), 10.4 (Power PC), or 10.4 (x86). I've tried both the standard and the 64 bit versions for 10.4 Power PC. However, although the 64 bit version works, I could not compile PHP against that distribution. I've had no problems with the non-64 bit version running on an iMac G5. You have a second choice too, between a Mac-style Package installer and a Unix style Tar package (found towards the bottom of the HTML page in the 'special' section). These instructions assume 10.4 Power PC Tar package. We'll install MySQL in the standard location of /usr/local. Type the following commands: To become the root user (give your admin password) type: $ sudo -sPassword: # To install MySQL (the name of the Tar archive will be different for other distributions; also, I've assumed the tar file was downloaded to ~/Desktop) type: # cd /usr/local# tar -xzf ~/Desktop/mysql-standard-5.0.18-osx10.4-powerpc.tar.gz # ln -s mysql-standard-4.1.16-apple-darwin8.2.0-powerpc mysql This uncompresses the archive and makes a symbolic link (not a copy) called mysql to the actual installation. Next, apply the correct owner and permissions to the install: # cd mysql# chown -R root:mysql . It's a good idea to add the path of the MySQL binaries to your PATH variable so you don't have to type the full path name to execute a MySQL command. (This assumes you are using the Bash shell. Other shells vary.) The path is '/usr/local/mysql/bin'. A typical PATH variable would be set in /etc/profile and look like this: declare -x PATH="\/usr/local/bin:/usr/bin:/bin:\ /usr/local/sbin:/usr/sbin:/sbin:\ /usr/X11R6/bin:\ /usr/local/mysql/bin:\ " The statement is broken into six lines. It's ok to break it like this in the file, provided '\' is added to the end of each broken line. The line pertinent to MySQL is '/usr/local/mysql/bin:\'. Tuesday's tip will show you how to create the MySQL database and test the installation. The database will be created in a more useful location that the default /usr/local/mysql/data. Visit the Site of the Book of the Unix Tips: Discuss this trick in the OSXFAQ Learning Center forum E-mail your comments or suggestions to webmaster@osxfaq.com
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||