FreeBSD/MySQL/phpMyAdmin の変更点


*phpMyAdmin [#u8d69937]

[[dokuwiki.fl8.jp転載済>http://dokuwiki.fl8.jp/doku.php/02_freebsd/04_database/01_mysql/mysql_phpmyadmin]]

WebブラウザからMySQLデータベースを管理するためのPHPで記述されたソフトウェアです。

phpMyAdminを使用してWebブラウザからMySQLのテーブル操作、インポート・エクスポートすることが出来ます。

#contents

**環境 [#jfbb0b38]
-FreeBSD 6.1
-PHP 4.4.4
-MySQL 4.1.23

**ダウンロード [#j6bea1ab]
[[phpMyAdmin Project>http://www.phpmyadmin.net/home_page/downloads.php]]より最新版をダウンロード。

**インストール [#g199ca48]
***展開 [#v6f87cd2]
Web上から表示できる場所に展開するとよいと思います。
 $ tar zxvf phpMyAdmin-2.9.2-all-languages.tar.gz
 $ mv phpMyAdmin-2.9.2-all-languages phpMyAdmin
 $ cp config.sample.inc.php config.inc.php

***設定変更 [#e20229ad]
 $ vi config.ini.php
 --------------------変更箇所-----------------------
 38 $cfg['Servers'][$i]['controluser'] = 'pmausr';
 39 $cfg['Servers'][$i]['controlpass'] = 'pmapass';
 
                      ↓
 38 $cfg['Servers'][$i]['controluser'] = '';
 39 $cfg['Servers'][$i]['controlpass'] = '';
 
 ------------------何かパスワードを設定------------
 17 $cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

これでmysqlに設定してあるユーザ名・パスワードでログインできます。
**確認 [#cb4b7524]
ウェブ上から確認。
 http://*******/phpMyAdmin

**最新のバージョンだとlibmcryptが無いと怒られる [#m8b1e10c]
 # cd /usr/ports/security/libmcrypt
 # make install clean
 
 ・PHPを下記の--with-mysql=/usr/localを加えて再インストール
 ./configure  --with-mysql=/usr/local \
 --with-apxs2=/usr/local/apache2/bin/apxs \
 --enable-pear --with-tsrm-pth --with-mcrypt=/usr/local \
 --with-gd --with-zlib --with-ttf=/usr/local \
 --with-freetype-dir=/usr/local --with-jpeg-dir=/usr/local \
 --with-png-dir=/usr/local --enable-force-cgi-redirect \
 --enable-mbstring --enable-mbstr-enc-trans \
 --enable-trans-sid --enable-versioning --enable-gd-native-ttf --enable-gd-jis-conv

*デフォルトでログインするように設定する。 [#v0bfc6c8]
デフォルトでログインするユーザ名:パスワードを設定する。~
auth_typeをconfigに変更する。
 # cd phpMyAdmin
 # cp config.sample.inc.php config.inc.php
 # vi config.inc.php
 下記を追加
 $cfg['Servers'][$i]['user'] = 'root';
 $cfg['Servers'][$i]['password'] = 'hogehoge';
 $cfg['Servers'][$i]['auth_type'] = 'config';

**この場合アクセスするだけで、ログインできてしまうのでBasic認証をかけておく [#c5084497]
 # cd phpMyAdmin
 # vi .htaccess 
 AuthUserFile   /home/www/public_html/phpMyAdmin/.htpasswd
 AuthGroupFile   /dev/null
 AuthName        "Please Enter Your Password"
 AuthType        Basic
 Require valid-user
**パスワードファイルの作成 [#yfcdefe4]
 # htpasswd -c .htpasswd hogehoge
 New password: 
 Re-type new password: 
 Adding password for user hogehoge

**アクセスできるDBを設定する。 [#s3ec9db0]
 199  * @global string $cfg['Servers'][$i]['only_db']
 200  */
 201 $cfg['Servers'][$i]['only_db'] = 'shinbutsu';