0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

さくらVPSサーバーにphpMyadminをインストールしてみた

Posted at

サーバー環境

  • さくらのVPS v4
  • PHP 5.6.40
  • CentOS Linux release 7.6.1810
  • MySQLインストール済

OSのバージョン確認

cat /etc/redhat-release

インストール手順

1.phpMyAdminのダウンロード。php5.2から5.4で使えるphpmyadminのバージョンは4.0。
  php5.5から7.0であれば4.9。php7.1以上であれば5.0。

phpMyadminダウンロード
https://www.phpmyadmin.net/downloads/
https://www.phpmyadmin.net/files/

wget https://files.phpmyadmin.net/phpMyAdmin/4.0.10.20/phpMyAdmin-4.0.10.20-all-languages.zip

2.解凍

unzip phpMyAdmin-4.0.10.20-all-languages.zip

3.解凍したフォルダを、phpmyadminという名前に変更して/var/wwwの下へ移動。

mv phpMyAdmin-4.0.10.20-all-languages phpmyadmin
mv phpmyadmin/ /var/www/.

4./var/wwwの下のconfig.sample.inc.phpをconfig.inc.phpとしてコピー。

cp config.sample.inc.php config.inc.php

5.config.inc.phpを編集。

diff config.inc.php config.sample.inc.php

< $cfg['blowfish_secret'] = 'xxxxxxxxxxx'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
---
> $cfg['blowfish_secret'] = 'a8b7c6d'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
48,60c48,60
< $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
< $cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
< $cfg['Servers'][$i]['relation'] = 'pma__relation';
< $cfg['Servers'][$i]['table_info'] = 'pma__table_info';
< $cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
< $cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
< $cfg['Servers'][$i]['column_info'] = 'pma__column_info';
< $cfg['Servers'][$i]['history'] = 'pma__history';
< $cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
< $cfg['Servers'][$i]['tracking'] = 'pma__tracking';
< $cfg['Servers'][$i]['designer_coords'] = 'pma__designer_coords';
< $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
< $cfg['Servers'][$i]['recent'] = 'pma__recent';
---
> // $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
> // $cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
> // $cfg['Servers'][$i]['relation'] = 'pma__relation';
> // $cfg['Servers'][$i]['table_info'] = 'pma__table_info';
> // $cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
> // $cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
> // $cfg['Servers'][$i]['column_info'] = 'pma__column_info';
> // $cfg['Servers'][$i]['history'] = 'pma__history';
> // $cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
> // $cfg['Servers'][$i]['tracking'] = 'pma__tracking';
> // $cfg['Servers'][$i]['designer_coords'] = 'pma__designer_coords';
> // $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
> // $cfg['Servers'][$i]['recent'] = 'pma__recent';

6.apacheにエイリアスの設定。
/etc/httpd/conf.dの下に、以下の内容でphpmyadmin.confを作成。

Alias /phpmyadmin /var/www/phpmyadmin
<Directory /var/www/phpmyadmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
<RequireAny>
Require ip 127.0.0.1
Require ip xxx.xxx.xxx.xxx
</RequireAny>
</IfModule>
</Directory>

7.コンフィグをテスト。

apachectl configtest

8.apacheを再起動。

systemctl restart httpd

9.許可したIPから/phpmyadminへブラウザでアクセス。
mysqliがない!というエラーが表示されたので、yum install php-mysqliを実行。

10.phpmyadminを使って、create_tables.sql をインポート。(phpmyadminのソースのexamplesフォルダの下にある)
この操作を行わないと、phpmyadminでデーブルを展開時に、

# 1146 - Table 'phpmyadmin.pma__table_uiprefs' doesn't exist

というエラーが発生する。

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?