WordplessとNucleus データベース・ユーザの変更


実験を進めやすくするためにWordplessとNucleusのデータベースのユーザを再設定する。

管理ユーザ再設定

mysql -uroot -rootpassword

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| mysql |
| nucleus1 |
| wordpless1 |
+--------------------+

ユーザの確認
mysql> SELECT Host, User, Password FROM mysql.user;

ユーザ削除
mysql> use mysql;
mysql> delete from user where user='OldNucleusUser' and host='localhost';
mysql> delete from user where user='OldWordplessUser1' and host='localhost';

ユーザ削除を確認
mysql> SELECT Host, User, Password FROM mysql.user;

新ユーザの設定
mysql> grant ALL on nucleus1.* to NewUserN1@localhost identified by 'newpasswd1n';
mysql> grant ALL on wordpress1.* to NewUserW1@localhost identified by 'newpasswd1w';

ユーザの確認
mysql> show grants for NewUserN1@localhost;
mysql> show grants for NewUserW1@localhost;

ユーザの確認
mysql> SELECT Host, User, Password FROM mysql.user;
+-----------+------------------+-------------------------------------------+
| Host | User | Password |
+-----------+------------------+-------------------------------------------+
| localhost | root | *xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
| localhost | supervisor | *xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
| localhost | NewUserN1 | *xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
| localhost | NewUserW1 | *xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
+-----------+------------------+-------------------------------------------+

WordPress データベース・ユーザ変更

以前のユーザを削除すると、WordPressがデータベースの認証に失敗する。
http://www.example.com/wordpress/

エラー: データベースに接続できません

新しいデータベース・ユーザに変更する。
wp-config.php
define('DB_NAME', 'wordpress1'); // データベース名
define('DB_USER', 'NewUserW1'); // ユーザー名
define('DB_PASSWORD', 'newpasswd1w'); // パスワード

Nucleus データベース・ユーザ変更

以前のユーザを削除したので、Nucleusがデータベースの認証に失敗する。
http://www.example.com/~nucleus/index.php?blogid=1

Connect Error

Could not connect to MySQL database.

新しいデータベース・ユーザに変更する。
config.php
// mySQL connection information
$MYSQL_HOST = 'localhost';
$MYSQL_USER = 'NewUserN1';
$MYSQL_PASSWORD = 'newpasswd1n';
$MYSQL_DATABASE = 'nucleus1';
$MYSQL_PREFIX = '';


疑問:でも大丈夫なんだろうか。
ユーザ名とパスワードを平文で書くことには抵抗がある。
SQLインジェクションならこれがわかれば一発だもんねぇ。

しかも パーミンションも644
とりあえず
(でも、アタックはブラウザ経由なので、ザルには変わりない)
されど、httpのユーザ wwwが読めなきゃ動かんし。

とりあえず実験中は、
/etc/apache2/conf.d/cms.confでアクセスを規制する。
Alias /cms /home/cms/www/wordpress
<Location /cms>
Order deny,allow
Deny from all
Allow from 127.0.0.1
Allow from 192.168.0
</Location>


23 Feb, 2008 | mokimoc
« Prev item - Next Item »
---------------------------------------------

Comments



Leave comments

このアイテムは閲覧専用です。コメントの投稿、投票はできません。