PHP & MySQL Setup

From Eunuchs to UNIX

Page 1: Turning on the Apache Web server-->>
Page 2: Enabling PHP-->
Page 3: Installing mySQL-->>
Page 4: Installing and configuring phpMyAdmin-->

Installing mySQL

Ready for the next step? Let's install mySQL. Go to the following Web site: http://www.entropy.ch/software/macosx/mysql/ to download the appropriate version of mySQL for your version of Mac OSX. Note that there are two sets of directions! One is exclusively for Jaguar, and the other is for earlier versions of Mac OS X. You need to create your own mySQL user in earlier versions of the OS, but there is a default mySQL user already installed in Jaguar.

This tutorial assumes that you have never installed mySQL before. If you do have an earlier version on your computer that you wish to remove, you need to very carefully follow Marc Liyanage's directions for cleaning up. For those of you installing for the first time, here are the steps as listed on Marc Liyanage's amazing Web site. Type accurately, and check for typos before pressing the return key between each command.

1. Download the package mysql-3.23.51-jaguar.pkg.tar.gz to your desktop. Unpack it and then double-click on the .pkg file to install it. Open a terminal window and type in the following commands (without the double quotes):
2. type "cd /usr/local/mysql"
3. type "sudo ./scripts/mysql_install_db", enter administrator password when asked
4. type "sudo chown -R mysql /usr/local/mysql/*"
5. type "sudo ./bin/safe_mysqld --user=mysql &"
6. Use it with "/usr/local/bin/mysql test"
7. If you do not want to have to type "/usr/local/bin" in front of every command, you have to add the /usr/local/bin directory to your PATH environment variable in your login script. For the default tcsh shell, you can do this by running this command once: "echo 'setenv PATH /usr/local/bin:$PATH' >> ~/.tcshrc"
8. After performing the above steps, read section 4.3 of the manual carefully, it explains how to set up permissions etc.
9. Important: You should at least run this command in order to secure the open master account in the default installation: mysqladmin -u root password new_password_here

Note that you actually type the word "password" and then the password of your choice. Marc also provides an automatic mySQL startup script you can put in the start up items folder of the main "Library" folder so that the mySQL server starts whenever you boot your computer.

We have some choices for interacting with mySQL. Of course, there is the Terminal for typing directly into the mySQL monitor. To access it, let’s first "cd" (change directories) at the prompt to get into the mySQL directory: cd /usr/local/bin/. Next we need to gain entry to the mySQL monitor: mysql –uroot –p[your_password_here] After pressing enter, the mySQL monitor welcome screen appears. At the prompt (mysql>) type SHOW DATABASES; (Don’t forget the semi-colon after each command.) After pressing enter, a list of the databases on the mySQL server pops up.

mySQL monitor

Install and configure phpMyAdmin, a GUI interface for mySQL-->
Back to Unix Tips Page-->