XREA+ データベース複数化

「Xrea+では、データベースを5つまで設置できる」
バカなことに最近知ったんですよ、これ。 :arrow-u:

1. MySQLの設定

矢印部を書込んで作成

XREA管理画面 > データベース にて、「■MySQL」の「データベース名を選択 : 」の○○○_2∼○○○_5から任意に選択し、データベース接続へのパスワードを入力。パスワードは○○○のデータベースと同じでもいい。その後「作成」をクリックして、5分ほど待つと設定が反映される。

2. phpMyAdmin の設定
phpMyAdminの設定ファイルを修正して、新しく作成したデータベースを管理できるようにする。
設定ファイル「/public_html/log/phpmyadmin/config.inc.php」をFTPソフトで一度DLして、テキストエディタで修正する。

  1. $cfg['Servers'][$i]['host'] = 'localhost';

  1. $cfg['Servers'][$i]['user'] = '○○○_2';
  2. $cfg['Servers'][$i]['password'] = 'password2';
  3. $cfg['Servers'][$i]['only_db'] = '○○○_2';

※1 ”○○○”はアカウント名
※2 ○○○_2を選択した例

テストサイトの wp-config.php はこうなる。

  1. define('DB_NAME', '○○○_2');    // The name of the database
  2. define('DB_USER', '○○○_2');     // Your MySQL username
  3. define('DB_PASSWORD', 'password2'); // ...and password
  4. define('DB_HOST', 'localhost');    // 99% chance you won't need to change this value

PHPMyAdmin

修正したconfig.inc.phpをアップロードして終了。phpMyAdminにアクセスして「サーバーの選択」から指定したデータベース名があるか確認する。

これでテストサイトを作って、遊んでみましょ。ぐちゃぐちゃになっても追加したデータベースをさくっと削除すれば問題ないし。テストサイトの不具合でメインサイトが足を引っぱられる心配もなし。しかも、同じ環境でテストできるし。(うはうは)

【2009-5-18 追記】
うれPさんにわかりにくいとのご指摘をいただいましたので、s297サーバーの config.sample.inc.php を参考に書いてみます。(もちろん、config.inc.php にリネームしなければなりません)

  1. <?php
  2.  
  3. /* $Id: config.sample.inc.php 9689 2006-11-10 20:05:49Z nijel $ */
  4. // vim: expandtab sw=4 ts=4 sts=4:
  5.  
  6. /**
  7. * phpMyAdmin sample configuration, you can use it as base for
  8. * manual configuration. For easier setup you can use scripts/setup.php
  9. *
  10. * All directives are explained in Documentation.html and on phpMyAdmin
  11. * wiki <http://wiki.cihar.com>.
  12. */
  13.  
  14. /*
  15. * This is needed for cookie based authentication to encrypt password in
  16. * cookie
  17. */
  18. $cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
  19.  
  20. /*
  21. * Servers configuration
  22. */
  23. $i = 0;
  24.  
  25. /*
  26. * First server
  27. */
  28. $i++;
  29. /* Authentication type */
  30. $cfg['Servers'][$i]['auth_type'] = 'cookie';
  31. /* Server parameters */
  32. $cfg['Servers'][$i]['host'] = 'localhost';
  33. $cfg['Servers'][$i]['connect_type'] = 'tcp';
  34. $cfg['Servers'][$i]['compress'] = false;
  35. /* Select mysqli if your server has it */
  36. $cfg['Servers'][$i]['extension'] = 'mysql';
  37. /* User for advanced features */
  38. $cfg['Servers'][$i]['controluser'] = 'pma';
  39. $cfg['Servers'][$i]['controlpass'] = 'pmapass';
  40. $cfg['Servers'][$i]['only_db']       = 'pma';
  41. /* Advanced phpMyAdmin features */
  42. // $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
  43. // $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';
  44. // $cfg['Servers'][$i]['relation'] = 'pma_relation';
  45. // $cfg['Servers'][$i]['table_info'] = 'pma_table_info';
  46. // $cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';
  47. // $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';
  48. // $cfg['Servers'][$i]['column_info'] = 'pma_column_info';
  49. // $cfg['Servers'][$i]['history'] = 'pma_history';
  50. // $cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';
  51.  
  52. /*
  53. * End of servers configuration
  54. */
  55.  
  56. /*
  57. * Directories for saving/loading files from server
  58. */
  59. $cfg['UploadDir'] = '';
  60. $cfg['SaveDir'] = '';
  61.  
  62. ?>

ユーザー"pma"、パスワード"pmapass" です。

で、2つ目のDBを作ります。ユーザー"pma2"、パスワード"pma2pass" でいきます。

  1. <?php
  2.  
  3. /* $Id: config.sample.inc.php 9689 2006-11-10 20:05:49Z nijel $ */
  4. // vim: expandtab sw=4 ts=4 sts=4:
  5.  
  6. /**
  7. * phpMyAdmin sample configuration, you can use it as base for
  8. * manual configuration. For easier setup you can use scripts/setup.php
  9. *
  10. * All directives are explained in Documentation.html and on phpMyAdmin
  11. * wiki <http://wiki.cihar.com>.
  12. */
  13.  
  14. /*
  15. * This is needed for cookie based authentication to encrypt password in
  16. * cookie
  17. */
  18. $cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
  19.  
  20. /*
  21. * Servers configuration
  22. */
  23. $i = 0;
  24.  
  25. /*
  26. * First server
  27. */
  28. $i++;
  29. /* Authentication type */
  30. $cfg['Servers'][$i]['auth_type'] = 'cookie';
  31. /* Server parameters */
  32. $cfg['Servers'][$i]['host'] = 'localhost';
  33. $cfg['Servers'][$i]['connect_type'] = 'tcp';
  34. $cfg['Servers'][$i]['compress'] = false;
  35. /* Select mysqli if your server has it */
  36. $cfg['Servers'][$i]['extension'] = 'mysql';
  37. /* User for advanced features */
  38. $cfg['Servers'][$i]['controluser'] = 'pma';
  39. $cfg['Servers'][$i]['controlpass'] = 'pmapass';
  40. $cfg['Servers'][$i]['only_db']       = 'pma';
  41. /* Advanced phpMyAdmin features */
  42. // $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
  43. // $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';
  44. // $cfg['Servers'][$i]['relation'] = 'pma_relation';
  45. // $cfg['Servers'][$i]['table_info'] = 'pma_table_info';
  46. // $cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';
  47. // $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';
  48. // $cfg['Servers'][$i]['column_info'] = 'pma_column_info';
  49. // $cfg['Servers'][$i]['history'] = 'pma_history';
  50. // $cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';
  51.  
  52. /*
  53. * Second server
  54. */
  55. $i++;
  56. /* Authentication type */
  57. $cfg['Servers'][$i]['auth_type'] = 'cookie';
  58. /* Server parameters */
  59. $cfg['Servers'][$i]['host'] = 'localhost';
  60. $cfg['Servers'][$i]['connect_type'] = 'tcp';
  61. $cfg['Servers'][$i]['compress'] = false;
  62. /* Select mysqli if your server has it */
  63. $cfg['Servers'][$i]['extension'] = 'mysql';
  64. /* User for advanced features */
  65. $cfg['Servers'][$i]['controluser'] = 'pma2';
  66. $cfg['Servers'][$i]['controlpass'] = 'pma2pass';
  67. $cfg['Servers'][$i]['only_db']       = 'pma2';
  68. /*
  69. * End of servers configuration
  70. */
  71.  
  72. /*
  73. * Directories for saving/loading files from server
  74. */
  75. $cfg['UploadDir'] = '';
  76. $cfg['SaveDir'] = '';
  77.  
  78. ?>

こんな要領で、5つまで増やせます。 :wink:

ツイート

Top

タグ
タグ: ,

ナビゲーションリンク
| UP |

の記事をすべて見る。

Top

コメントが 13件あります

コメント RSS を使用するとこの投稿のコメントが確認できます。
TrackBack URI
コメントしてみる?

  1. tao さんのコメント
    2007年 2月 16日 07:30 # Japan Windows Mozilla Firefox

    ありゃ?知らなかったの?
    普通に使えてますよん!
    これにて速くなるかは?です。

    返信する

    • Masayan さんのコメント
      2007年 2月 16日 19:13 # Japan Windows Mozilla Firefox

      ありゃ?知らなかったの?

      教えてよん。 :mrgreen:
      速くなるのはまるで期待してませんが、別にしておいた方が削除の際に間違えなくてよいかと・・・。 :)

      返信する

  2. moo さんのコメント
    2007年 2月 17日 21:36 # Japan Mac OS Opera

    はじめまして
    いつもwpのカスタマイズを参考にさせてもらっています。

    XREAのデータベースのphpMyAdminのバージョンによってはconfig.inc.phpを編集しなくても複数使えるのもあります。
    2年前の2.6.1-pl2はXREAの鯖の管理画面から複数作成すれば自然に反映されていました。

    ところが2.8.0-rc1だとconfig.inc.phpの編集が必要なんですよね。
    MacIEからだとかなりレイアウトも崩れるのでCSSの編集まで必要になります。
    バージョンが上がって使いづらくなりました :cry:

    返信する

    • Masayan さんのコメント
      2007年 2月 18日 09:58 # Japan Windows Mozilla Firefox

      はじめまして、mooさん。

      へぇ∼、そうなんですか。
      Xrea歴1年たたないもので、まだまだ知らないことも多いっす。

      phpMyAdminよりMySQLのバージョンを上げてくれないかなぁ∼。 :mrgreen:

      返信する

  3. Sa・Ga さんのコメント
    2007年 2月 18日 12:17 # Japan Windows Opera

     phpMyAdminだったら、WordPressのプラグインに「WP-phpMyAdmin Plugin」がありますよ∼。

     しかも、Masayan様自ら日本語化に取り組まれていますよ∼

     しかし、ヴァージョンを確認したら2.8.2だった(自爆)。 :lol:

    返信する

  4. 亜矢 さんのコメント
    2008年 3月 18日 12:50 # Japan Windows Lunascape

    はじめまして。

    お試しでCOREを使っているところですが、こちらの情報がとても役に立ちました!

    ※ 複数のデータベースをご利用になる場合は、設定ファイル「config.inc.php」のパスワードなどを変更してください。

    とだけしか書かれてなくて困っていました。
    上記の通り書き直して無事に増やすことができました。ありがとうございました :D

    返信する

  5. うれP さんのコメント
    2009年 5月 17日 20:23 # Japan Windows Mozilla Firefox

    ( ノ゚Д゚)こんばんわ
    以前は、DBを追加で作成したら、phpadmimin でDBが選択できていたのに・・・
    s366鯖に移動したら、できなくなっていました ><
    コントロールパネルからはDBが見えるのに、phpadminでは見えなくて、【また】DBが壊れたのかと、XREAに問い合わせしようとしたたとこでした ^^;
    config.inc.phpの書き方とか、こことか、他のサイトも見たんだけど・・・
    よくわかんない ><
    $i=0;
    $1++;
    とかって・・・?
    どこからどこまでが、一つで、新しいDBの記述はどこに書けばいいのか ^^;
    (´ヘ`;) う∼ん・・・
    _| ̄|○ il||li

    返信する

    • Masayan さんのコメント
      2009年 5月 18日 09:26 # Japan Windows Mozilla Firefox

      おはよう。

      上の記事に追記してみました。どうもコメントじゃ説明できない。orz

      返信する

  6. hk さんのコメント
    2009年 12月 9日 22:25 # Japan Windows Mozilla Firefox

    こんばんわ。
    参考になります。が、どうも上手くいきません。
    私はs335サーバーでmyphpadminで2個目のデータベースが見れません。
    なんとかエクスポートしないと引越しが出来ない・・・

    config.ing.phpを書き換える際行ったことは、
    * Second server以下をコピペして付け足し、です。

    >修正したconfig.inc.phpをアップロードして終了。phpMyAdminにアクセスして
    >「サーバーの選択」から指定したデータベース名があるか確認する。

    なんとかここまでは出来ました。が、ログインできません。
    あらゆるユーザー名とPassを入れたのですが。

    なにが足りないのでしょうか?

    返信する

    • Masayan さんのコメント
      2009年 12月 10日 08:40 # Japan Windows Mozilla Firefox

      はじめまして、hkさん。

      なんとかエクスポートしないと引越しが出来ない・・・

      もう作ってるのに見えないってことですか?

      あらゆるユーザー名とPassを入れたのですが。

      あらゆるも何もPHPMyAdminにログインできれば見れるはずですが・・・・。 :!:

      もう少しわかりやすいように画像を追加しました。どうでしょう?

      返信する

      • hk さんのコメント
        2009年 12月 10日 20:56 # Japan Windows Mozilla Firefox

        Masayan さん

        早速のアドバイスありがとうございます。
        UPして頂いた画像の所までは出来まして、localhostpma2がプルダウンメニューから見えるのですが、選択するとログイン画面に戻ってしまい、
        ログインを試みても

        エラー
        #1045 – Access denied for user ‘pma2′@’localhost’ (using password: YES)

        というのが出てしまいログイン出来ないです。
        DB/ユーザー名やパスワードは登録してある全てのMySQLのデータベースの物を入れてみたのですが、どうしてもログインが出来ない状態です。

        ここは何を入れれば良いのでしょうか?

        返信する

        • Masayan さんのコメント
          2009年 12月 11日 08:09 # Japan Windows Mozilla Firefox

          そういうことなんですね。
          なんかググるとかなりヒットしますねぇ・・・。

          Google 検索

          ユーザーアカウントにハイフンが入ってちゃダメ

          config.inc.phpファイルは、configディレクトリの下ではなく、phpMyAdminのルートディレクトリに配置するんです!

          コントロールパネルで、パスワードを16文字以上設定しようとして、15文字に切り詰められてしまっている。

          いろいろあるんですねー。知りませんでした。イマイチな回答でスイマセン。 :oops:

Top

コメントをどうぞ


:x :wink: :twisted: :shock: :sad: :oops: :o :mrgreen: :lol: :idea: :evil: :cry: :cheesy: :arrow-u: :arrow-l: :arrow-d: :D :?: :) :!: 8)
あなたの情報 (必須) help

twitter

e-mail

Top

Web Services by Yahoo! JAPAN