0

サポートデータベースを作成したいと思います。config.inc.php ファイルに、データベース (ホスト、ログイン、パスワード) にログインするための情報があります。

しかし、定義されたすべてのデータベースにグローバルユーザーを設定したいと思います。そのため、グローバル ログインとパスワードを作成し、定義したすべてのデータベースを管理できます。しかし、私はそれを行う方法を知りませんか?

これは私のconfig.inc.phpの断片です:

/*
 * Servers configuration
 */
$i = 0;

/* Authentication type */
$i++;
$cfg['Servers'][$i]['user'] = 'global user';
$cfg['Servers'][$i]['password'] = 'password global user\'s'; // use here your password
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['AllowNoPassword'] = false;
/* Server parameters */
$i++;
$cfg['Servers'][$i]['host'] = 'host.frist.database';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['hide_db'] = 'information_schema';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Servers'][$i]['user'] = 'user.frist.bazy';
$cfg['Servers'][$i]['password'] = 'password.frist.database';

$i++;
$cfg['Servers'][$i]['host'] = 'host.second.database';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['hide_db'] = 'information_schema';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Servers'][$i]['user'] = 'user.second.bazy';
$cfg['Servers'][$i]['password'] = 'password.second.database';

わからない、どうしよう…

4

1 に答える 1

0

「グローバル」構成を別の配列に保存し、これを各サーバーのデフォルトとして使用します。たとえば、次のようにします。

$global['user'] = 'global user';
$global['password'] = 'password global user\'s'; // use here your password
$global['auth_type'] = 'config';
$global['AllowNoPassword'] = false;

/*
 * Servers configuration
 */
$i = 0;


$i++;
$cfg['Servers'][$i] = $global;
/* individual config for first server */
$cfg['Servers'][$i]['host'] = 'host.frist.database';
$cfg['Servers'][$i]['user'] = 'user.frist.bazy';
$cfg['Servers'][$i]['password'] = 'password.frist.database';


$i++;
$cfg['Servers'][$i] = $global;
/* individual config for second server */
$cfg['Servers'][$i]['host'] = 'host.second.database';
$cfg['Servers'][$i]['user'] = 'user.second.bazy';
$cfg['Servers'][$i]['password'] = 'password.second.database';
于 2020-08-20T07:01:53.260 に答える