====== MySQL - PHPMyAdmin ====== WebブラウザからMySQLデータベースを管理するためのPHPで記述されたソフトウェアです。 phpMyAdminを使用してWebブラウザからMySQLのテーブル操作、インポート・エクスポートすることが出来ます。 ====== 環境 ====== * FreeBSD 6.1 * PHP 4.4.4 * MySQL 4.1.23 ====== ダウンロード ====== [[http://www.phpmyadmin.net/home_page/downloads.php|phpMyAdmin Project]]より最新版をダウンロード。 ====== インストール ====== ===== 展開 ===== 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 ==== 設定変更 ==== $ 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に設定してあるユーザ名・パスワードでログインできます。 ===== 確認 ===== ウェブ上から確認。 http://*******/phpMyAdmin ===== 最新のバージョンだとlibmcryptが無いと怒られる ===== # 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 ===== デフォルトでログインするように設定する。 ===== デフォルトでログインするユーザ名:パスワードを設定する。\\ 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認証をかけておく ===== この場合アクセスするだけで、ログインできてしまうのでBasic認証をかけておく # cd phpMyAdmin # vi .htaccess AuthUserFile /home/www/public_html/phpMyAdmin/.htpasswd AuthGroupFile /dev/null AuthName "Please Enter Your Password" AuthType Basic Require valid-user ===== パスワードファイルの作成 ===== # htpasswd -c .htpasswd hogehoge New password: Re-type new password: Adding password for user hogehoge ===== アクセスできるDBを設定する。 ===== 199 * @global string $cfg['Servers'][$i]['only_db'] 200 */ 201 $cfg['Servers'][$i]['only_db'] = 'shinbutsu'; ====== phpMyAdminでeucが文字化け ====== ■phpMyAdmin/libraries/database_interface.lib.phpを編集する function PMA_DBI_postConnect 全部をコメントアウトして下記ソースに変更 function PMA_DBI_postConnect($link, $is_controluser = false) { require_once('./libraries/charset_conversion.lib.php'); }