I’ve been putting off the installation of Apache, PHP and MySQL on my Powerbook for some time now. I’m not really sure why since I didn’t think it would be all that difficult, and after finding out how easy it really was today, I wish I had done it months ago.

First of all, Apache and PHP are already installed, this makes things pretty simple. In order to get PHP running, a few minor changes need to be made in the httpd config. I found these instructions to be quite helpful for the Apache and PHP configuration, I skipped his MySQL and Dreamweaver instructions though.

A MySQL installer for Mac OS 10.2 and 10.3 is available from MySQL’s site. Included in the download is an install package for the auto-startup utility as well.

If you do any MySQL work at all, even if you don’t have it installed on your local machine, I highly recommend CocoaMySQL. It is a clean and simple GUI front end for working with MySQL databases.

Update [more MySQL]:

After installing MySQL, there are a few statements you might want to run to secure things before moving on. Methods to secure MySQL are well documented, this is what I chose to do since my installation is only for development purposes:

After installation, the root password is not set, so I gave the root logon a password:

UPDATE user SET Password = PASSWORD("password")
WHERE User = "root";

There is also a user without a username, this is used when no user is specified when connecting to the database. I don’t need this, so I deleted the user:

DELETE FROM User
WHERE User = "";

Since I don’t log into my computer as root, I thought it would helpful to have a superuser with the same name as the OSX username I normally use. This username will be used for all DB maintenance tasks:

GRANT ALL ON *.* TO user@localhost IDENTIFIED BY "password"
WITH GRANT OPTION;

Normally, in a production environment, web applications will connect to the database with limited permissions. To simulate this in the development environment, a webuser login is created for web applications. In this case, webuser’s permissions are not all that limited, but they can be modified easily to simulate more restrictive permissions (like read only) without affecting my login. This is useful in testing to make sure the application won’t break when it gets more restricted access than it was used to in the development environment. The following statement assumes that a new database named “webdev” has been created:

GRANT SELECT, INSERT, UPDATE, DELETE ON webdev.*
TO webuser@localhost IDENTIFIED BY "password";

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.