LoginSignup
26
25

More than 5 years have passed since last update.

MAMPのphpMyAdminバージョンアップ

Posted at

背景

ある友人がMAMPを使用していてphpMyAdminをバージョンアップしたところ、
「環境補間領域が完全に設定されていないため、いくつかの拡張機能が無効になっています。理由についてはこちらをご覧ください。」
と表示がされちゃうので、これを解消する方法を教えて!
とHelpあり。友人のスキルから、なるべくブラウザでの操作とテキスト編集だけで設定できるよう手順書を作成しました。

前提

  • Apache, PHP, MySQL, phpMyAdminのディレクトリ構成はMAMPをインストールした状態のままであること。
  • Swekey認証機能については触れません。
  • SQLが分かる人は、/Applications/MAMP/bin/phpMyAdmin/examples/create_tables.sql にて直接pma用のユーザを作成する事により、5.の行程を飛ばせます。

手順

1. phpMyAdminバックアップ

phpMyAdminのディレクトリ(/Applecations/MAMP/bin/phpMyAdmin)を別名保存するなりして、バックアップしておく。

2. 新しいphpMyAdminのインストール

  1. phpMyAdminのサイト からダウンロードする。
  2. ダウンロードしたphpMyAdmin-(バージョン番号)-all-languages.zipを解凍する。
  3. 解凍して出来たphpMyAdmin-(バージョン番号)-all-languagesディレクトリ名をphpMyAdminに変更する。
  4. 3.のphpMyAdminを /Applications/MAMP/bin の下にコピーする。

3. phpMyAdmin画面表示

Webブラウザから http://localhost:8888/phpMyAdmin/ にアクセスする。
phpMyAdminログイン画面.png

ユーザ名/パスワードにはMySQLのログイン名/パスワードを使用してログインする。

  • phpMyAdmin(4.1.7)ではX-Frame-OptionsにDENYが設定されているため、MAMPのスタートページからphpMyAdminのリンククリックで表示しようとすると、フレーム内に表示できない。

4. phpMyAdminデータベース作成

インポートをクリックする。

インポート画面.png

アップロードファイル「選択」ボタンをクリック

選択.png

/Applications/MAMP/bin/phpMyAdmin/examples/create_tables.sql を選択する。

実行ボタンを押す。

実行.png

「インポートは正常に終了しました。17個のクエリを実行しました。」が表示されるはず。

実行結果.png

5. phpMyAdminデータベース用特権ユーザ作成

左ペインのphpMyAdminをクリックし、データベース: phpMyAdminを表示する。

phpmyadminテーブル.png

特権画面を表示する。

特権ボタン.png

特権画面.png

Newカテゴリの「ユーザを追加する」ボタンをクリックする。

ユーザ追加.png

ログイン情報カテゴリの以下の項目を入力する。

  • User name: 適当な新規のユーザ名 例: pma
  • Host: プルダウンメニューから「ローカル」を選択
  • パスワード: 適当なパスワード
  • Re-type: パスワードを再入力

 ※ここで入力したユーザ名/パスワードは後で使用するので覚えておくこと

ユーザ専用データベースカテゴリの以下の項目をチェックする。
「データベース"phpMyAdmin"への全ての特権を与える」

ユーザ追加画面.png

実行ボタンを押す。

特権実行ボタン.png

左ペインのログアウトボタン(左から2番目のアイコン)をクリックして、ログアウトする。

ログアウトボタン.png

ログアウト画面.png

6. config.inc.php作成

/Applications/MAMP/bin/phpMyAdmin にあるconfig.sample.inc.phpをテキストエディットで開く。

以下に「<-----(*)」で示す項目の行先頭にある「// 」を削除する

  • 編集前
/*
 * phpMyAdmin configuration storage settings.
 */

/* User used to manipulate with storage */
// $cfg['Servers'][$i]['controlhost'] = '';                           <-----(*)
// $cfg['Servers'][$i]['controlport'] = '';                           <-----(*)
// $cfg['Servers'][$i]['controluser'] = 'pma';                        <-----(*)
// $cfg['Servers'][$i]['controlpass'] = 'pmapass';                    <-----(*)

/* Storage database and tables */
// $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';                       <-----(*)
// $cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';            <-----(*)
// $cfg['Servers'][$i]['relation'] = 'pma__relation';                 <-----(*)
// $cfg['Servers'][$i]['table_info'] = 'pma__table_info';             <-----(*)
// $cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';         <-----(*)
// $cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';               <-----(*)
// $cfg['Servers'][$i]['column_info'] = 'pma__column_info';           <-----(*)
// $cfg['Servers'][$i]['history'] = 'pma__history';                   <-----(*)
// $cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';       <-----(*)
// $cfg['Servers'][$i]['tracking'] = 'pma__tracking';                 <-----(*)
// $cfg['Servers'][$i]['designer_coords'] = 'pma__designer_coords';   <-----(*)
// $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';             <-----(*)
// $cfg['Servers'][$i]['recent'] = 'pma__recent';                     <-----(*)
// $cfg['Servers'][$i]['users'] = 'pma__users';                       <-----(*)
// $cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';             <-----(*)
// $cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding'; <-----(*)
/* Contrib / Swekey authentication */
// $cfg['Servers'][$i]['auth_swekey_config'] = '/etc/swekey-pma.conf';

  • 編集後
/*
 * phpMyAdmin configuration storage settings.
 */

/* User used to manipulate with storage */
$cfg['Servers'][$i]['controlhost'] = '';
$cfg['Servers'][$i]['controlport'] = '';
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = 'pmapass';

/* Storage database and tables */
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
$cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
$cfg['Servers'][$i]['relation'] = 'pma__relation';
$cfg['Servers'][$i]['table_info'] = 'pma__table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma__column_info';
$cfg['Servers'][$i]['history'] = 'pma__history';
$cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
$cfg['Servers'][$i]['tracking'] = 'pma__tracking';
$cfg['Servers'][$i]['designer_coords'] = 'pma__designer_coords';
$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
$cfg['Servers'][$i]['recent'] = 'pma__recent';
$cfg['Servers'][$i]['users'] = 'pma__users';
$cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
$cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
/* Contrib / Swekey authentication */
// $cfg['Servers'][$i]['auth_swekey_config'] = '/etc/swekey-pma.conf';

さらに以下の項目を編集する。

$cfg['Servers'][$i]['controluser'] = '「5. phpMyAdminデータベース用特権ユーザ作成」のUser nameで入力した文字列'; 
$cfg['Servers'][$i]['controlpass'] = '「5. phpMyAdminデータベース用特権ユーザ作成」のパスワードで入力した文字列';

編集したconfig.sample.inc.phpをconfig.inc.phpとして /Applications/MAMP/bin/phpMyAdmin に保存する。

7. phpMyAdmin画面表示

Webブラウザから http://localhost:8888/phpMyAdmin/ にアクセスする。

phpMyAdminログイン画面.png

ユーザ名/パスワードにはMySQLのログイン名/パスワードを使用してログインする。

phpMyAdmin画面.png

「環境補間領域が完全に設定されていないため、いくつかの拡張機能が無効になっています。理由についてはこちらをご覧ください。」の表示が消えてればOK。

参考リンク

phpMyAdmin の設定保存場所の設定 - phpMyAdminの使い方
phpMyAdmin 環境保管領域が完全に設定されていないため、いくつかの拡張機能が無効になっています。理由についてはこちらをご覧ください。 - プログラムと絵と写真

26
25
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
26
25