コマンドラインでのデータベース操作もいいのですが、phpMyAdminを導入するとWeb経由でデータベースの管理が出来るようになります。
[root@jiro]/usr/ports# portinstall databases/phpmyadmin
デフォルトでは、/usr/local/www/phpMyAdmin/ にインストールされます。
こういったWeb経由での管理ツール(例えばqmailadminも)は、外部に見せる必要はないので、Webのコーナーでも書いたように、内部用のサイトに置くことをおすすめします。
バーチャル山中家では、/data/Web/lan/ が内部用サイトのディレクトリなので、そこへコピーしました。
すると、ブラウザからは、http://lan.yamanakake.com/phpMyAdmin/ でアクセスできるはずです。
ためしにインストール直後の状態でアクセスしてみると、
phpMyAdmin は、MySQL サーバーに接続しようとしました。そして、サーバーは接続を拒絶しました。
config.inc.php の中のホスト、ユーザー名およびパスワードをチェックし、
MySQL サーバーの管理人から与えられた情報にそれらが相当することを確かめるべきです。
と、丁寧に怒られます(笑)
早速、config.inc.phpを見てみましょう。
[root@jiro]/usr/ports# cd /data/Web/lan/phpMyAdmin/ [root@jiro]/data/Web/lan/phpMyAdmin# ee config.inc.php
/** * Sets the php error reporting - Please do not change this line! */ if (!isset($olderrorreporting)) { errorreporting(EALL); @iniset('displayerrors', '1'); }
変えるな!って書いてあるので、そのままにしておきます。
/** * Your phpMyAdmin url * * Complete the variable below with the full url ie * http://www.yourweb.net/pathtoyourphpMyAdmindirectory/ * * It must contain characters that are valid for a URL, and the path is * case sensitive on some Web servers, for example Unix-based servers. * * In most cases you can leave this variable empty, as the correct value * will be detected automatically. However, we recommend that you do * test to see that the auto-detection code works in your system. A good * test is to browse a table, then edit a row and save it. There will be * an error message if phpMyAdmin cannot auto-detect the correct value. * * If the auto-detection code does work properly, you can set to TRUE the * $cfg['PmaAbsoluteUriDisableWarning'] variable below. */ $cfg['PmaAbsoluteUri'] = 'http://lan.yamanakake.com/phpMyAdmin/';
インストールした先をURLで書いてねとあります。
書かなくても自動的に検出すると思うけど、上手くいかないかもよ、とも書いてあります。
ま、書いておきましょう。
$cfg['Servers'][$i]['auth_type'] = 'config'; // Authentication method (config, http or cookie based)?
ここをhttpにしておけば、WebにアクセスするたびにIDとパスワードを入力する認証方式になります。configのままにしておいて、
$cfg['Servers'][$i]['user'] = 'root'; // MySQL user $cfg['Servers'][$i]['password'] = ''; // MySQL password (only needed // with 'config' auth_type)
ここでuserとpasswordを適切に設定しておく方法もあります。
バーチャル山中家では、LANから私しかアクセスしないので、configにしておいてパスワードを設定しました。
