Tips_sql   >   Mysql   >   phpMyAdmin
phpMyAdmin
phpMyAdmin
is a widely used GUI administration tool for MySQL. Being browser based you don't need any client side software to use it and depending on how you set it up you could also access if from anywhere on the internet.
Installing
PHP and
phpMyAdmin on my MacBook Pro is where I spent many hours. Hopefully the tips in this section will save you some grief. Once
phpMyAdmin is set up and running it works great.
Installing PHP on Mac OS X
Before you do anything, check to see if PHP is installed and enabled on your Mac as follows:
- Turn on Personal Web Sharing in the System Preferences under Sharing.
- Go to Library/WebServer/Documents and create a file called phpinfo.php using a text editor.
- Enter the following text in the file and save the file.
<?php phpinfo() ?>
- From your web browser enter the URL localhost/phpinfo.php
- If PHP is enabled, you will get a page with all kinds of info about PHP displayed in your browser. If PHP not enabled you will just get the text of your file displayed in the browser.
If you need to enable PHP do the following from the command line:
- Go to the httpd directory
cd /etc/httpd
- Open the httpd configuration file as super user using pico or the text editor of your choice. (My preference is BBedit). You will need to enter the root password for your computer.
sudo pico -w httpd.conf
- In the config file you will need to find and uncomment the following lines by deleting the # character at the beginning of the line.
For Mac OS X 10.5
#LoadModule php5_module
For Mac OS X 10.4
#LoadModule php4_module
#AddModule mod_php4.c
- Ctrl+X to exit pico.
- Stop and restart Personal Web Sharing in the System Preferences.
- Try the localhost/phpinfo.php in your web browser again. Be sure to reload the page.
- If that doesn't work Google around for tips from other developers.
Once you have PHP working you are ready to install
phpMyAdmin.
Installing PHP on WinXP
On WinXP you will need to install/enable web server software on their computer. You can only run your computer as a web server if you have WinXP Pro. Afer installing and setting up your computer as a web server type in http://localhost/ in your browser to test whether or not it is working.
Once you have your WinXP computer working as a web server you are ready to install PHP.
Google for
Download PHP for WinXP and then download and install the latest version of PHP following the directions provided.
Installing phpMyAdmin on Mac OS X
phpMyAdmin
is easy to install, but I had a tough time getting the config file sorted out so that it would work on my MacBook Pro.
- Download phpMyAdmin from www.phpmyadmin.net. At the time of writing this I could not get the 2.8 version to work property. There isn't a package installer for Mac OS X so I just download the zip version. The download is small.
- Drag a copy of the downloaded and unzipped folder into your /Library/WebServer/Documents folder.
- Rename the folder to pma to save you some typing in your web browser.
- The documentation talks about a config.inc.php file which you are supposed to modify rather than the config.default.php file. (There is a warning at the top of the config.default.php file.) In my case no such file existed. Eventually I created the file myself directly inside the pma folder and found that the following text in the file did the trick.
$cfg['blowfish_secret'] = 'ae85mh04wq23'; // Enter a random string to be used for blowfish encryption
// Server(s) configuration
$i = 0;
$i++;
$cfg['Servers'][$i]['host'] = '127.0.0.1'; // 'localhost' did NOT work!
$cfg['Servers'][$i]['connect_type'] = 'socket'
$cfg['Servers'][$i]['auth_type'] = 'cookie'
$cfg['Servers'][$i]['user'] = ''
$cfg['Servers'][$i]['password'] = ''
?>
- Go to localhost/pma in your web browser. All going well you will be prompted to enter a user name and password. You can either enter the root user name and password or the DBADMIN user name and password if you created one.
- Click the Logon button. All going well you will be presented with a Welcome to phpMyAdmin page.