phpMyAdmin for multi-user environment on OSX Server 10.2+ (Jaguar)


Install Instructions

curl -O http://easynews.dl.sourceforge.net/sourceforge/phpmyadmin/phpMyAdmin-2.4.0-php.tar.gz

HTTP and cookie authentication modes are recommended in a multi-user environment where you want to give users access to their own database and don't want them to play around with others. Even in a single-user environment, you might prefer to use HTTP or cookie mode so that your user/password pair are not in clear in the configuration file.

1.

Open config.inc.php and edit the following line near the top of the page:

$cfg['PmaAbsoluteUri'] = 'http://www.your_web.net/path_to_your_phpMyAdmin_directory/';

A little further below change 'config' to 'http'

$cfg['Servers'][$i]['auth_type'] = 'http'; // Authentication method (config, http or cookie based)?

2.

Open your browser and point to http://www.your_web.net/phpMyAdmin/index.php

Login with username 'root' and leave the password empty.     *

3.

Select database "mysql", than click on "SQL" tab. Copy and run the following directives via "SQL"

GRANT USAGE ON mysql.* TO 'admin'@'localhost' IDENTIFIED BY 'password';
GRANT SELECT (
    Host, User, Select_priv, Insert_priv, Update_priv, Delete_priv,
    Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv,
    File_priv, Grant_priv, References_priv, Index_priv, Alter_priv,
    Show_db_priv, Super_priv, Create_tmp_table_priv, Lock_tables_priv,
    Execute_priv, Repl_slave_priv, Repl_client_priv
    ) ON mysql.user TO 'admin'@'localhost';
GRANT SELECT ON mysql.db TO 'admin'@'localhost';
GRANT SELECT ON mysql.host TO 'admin'@'localhost';
GRANT SELECT (Host, Db, User, Table_name, Table_priv, Column_priv)
    ON mysql.tables_priv TO 'admin'@'localhost';

When finished, click on users, than "BROWSE" tab. Select "Edit" localhost root, then type in a password in the appropriate field and select funtion as "password" and submit the change.

4.

RESTART COMPUTER.

5.

As an example for multiuser setup let's do the following:

Login with username: root, password: password at http://www.your_web.net/phpMyAdmin/index.php.

Create two new databases, one called "test" and other "test2"

Create two new users (username "test" and "test2" with password "test" and "test2" as well in user table of mysql database with "No" to all privilidges. (set field function to "password" in the editing window)

Inser two new rec under db table of mysql dabase with privilidges set to "Yes" on all, except "Grant_priv", "Create_tmp_table_priv" and "Lock_tables_priv".

Reload mysql and logout from root. Next time you log in as test with "password", you will have control only to that database.

*

As an alternative, simply download and run sample mysql files. (Just create two new databases, one called "test" and other "test2" before running them) Then you can log in as username "root", password "letmein" (change the password eventually) to control eveything as a superuser, and two other users with username "test" and "test2" with password "test" and "test2" who can control ONLY their respective databases.