DirectNET

Data Center Management Solutions including UPS Systems, Data Center Cooling, KVM over IP & IP Power Strips, Server Racks and Server Rack accessories; KVM Switches and KVM Extenders; Rackmount Monitors and Rackmount Keyboards.


NAVIGATION
Home
Store
INSIDE MAC
Television Shows
Broadcast Shows
Daily News Shows
Special Shows
EVENTS
DAILY TIPS
Design
Mac OS X
Mac OS X UNIX
COMMUNITY
Surveys
NEWS
Current
Press
Archive
FEATURES
Editorial
Dr. Mac
Reviews
Reader Reports
RESOURCES
FAQ
Documentation
Learning Center
MAN pages
Glossary
Tutorials
Tips
Links

OUR PARTNERS

OSXFAQ Mac OS X UNIX Tip-of-the-Day  back to index

MySQL - Grab MySQL

By Adrian Mayo - Editor - OSXFAQ

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 -s
Password:
#

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


Copyright © 2000-2010 Inside Mac Media, Inc. All rights reserved.
Apple assumes no responsibility with regard to the selection, performance, or use of the products or services. All understandings, agreements, or warranties, if any, take place directly between the vendors and prospective users.
Apple, the Apple logo, Mac, PowerMac G4, PowerMac G5, Xserve, Xserve RAID, PowerBook, iBook, Airport, AirPort Extreme, iMac, eMac, iLife, iMovie, iCal, iPhoto, iTunes, QuickTime, FireWire, iPod, iSight, AppleWorks, Macintosh, Jaguar, Panther, Mac OS, Mac OS X and Mac OS X Server are trademarks of Apple Computer, Inc.