MySQL 8.0 : phpMyAdmin インストール2024/09/03 |
phpMyAdmin をインストールして、Web ブラウザー経由で MySQL の操作ができるように設定します。 |
|
[1] | |
[2] | |
[3] | phpMyAdmin をインストールします。 |
root@dlp:~ #
root@dlp:~ # pkg install -y phpMyAdmin5-php83 php83-mysqli php83-fileinfo php83-session php83-curl mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 13 Server version: 8.0.35 Source distribution Copyright (c) 2000, 2023, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. # [phpmyadmin] データベース作成 root@localhost [(none)]> create database phpmyadmin; Query OK, 1 row affected (0.000 sec) root@localhost [(none)]> create user pma@'localhost' identified by 'password'; Query OK, 0 rows affected (0.01 sec) root@localhost [(none)]> grant all privileges on phpmyadmin.* to pma@'localhost'; Query OK, 0 rows affected (0.02 sec) root@localhost [(none)]> exit Bye
root@dlp:~ #
cd /usr/local/www/phpMyAdmin/sql root@www:/usr/local/www/phpMyAdmin/sql # mysql < create_tables.sql root@www:/usr/local/www/phpMyAdmin/sql # cd
root@dlp:~ #
vi /usr/local/etc/apache24/Includes/phpmyadmin.conf # 新規作成
Alias /phpmyadmin/ "/usr/local/www/phpMyAdmin/"
<Directory "/usr/local/www/phpMyAdmin/">
DirectoryIndex index.php
Options None
AllowOverride Limit
# アクセス許可する範囲を指定
Require ip 127.0.0.1 10.0.0.0/24
</Directory>
root@dlp:~ #
vi /usr/local/www/phpMyAdmin/config.inc.php <?php /* Skeleton configuration file -- this file is empty on a fresh * installaton of phpmyadmin. * * Copy any settings you want to override from * libraries/config.default.php or visit /phpmyadmin/setup/ to generate a * basic configuration file * */ # 以下のように追記 $i = 0; $i++; $cfg['Servers'][$i]['verbose'] = ''; $cfg['Servers'][$i]['host'] = '127.0.0.1'; $cfg['Servers'][$i]['port'] = ''; $cfg['Servers'][$i]['socket'] = ''; $cfg['Servers'][$i]['auth_type'] = 'cookie'; $cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]['password'] = ''; $cfg['blowfish_secret'] = \sodium_hex2bin('5ba7c764dd668516338af26f2a299a246cac1b9a40341343951a44059279bcaa'); $cfg['DefaultLang'] = 'en'; $cfg['ServerDefault'] = 1; $cfg['UploadDir'] = ''; $cfg['SaveDir'] = ''; $cfg['Servers'][$i]['controlhost'] = ''; $cfg['Servers'][$i]['controlport'] = ''; $cfg['Servers'][$i]['controluser'] = 'pma'; # パスワードは上で [pma] ユーザーに設定したパスワードに置き換え $cfg['Servers'][$i]['controlpass'] = 'password'; $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin'; $cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark'; $cfg['Servers'][$i]['central_columns'] = 'pma__central_columns'; $cfg['Servers'][$i]['column_info'] = 'pma__column_info'; $cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings'; $cfg['Servers'][$i]['export_templates'] = 'pma__export_templates'; $cfg['Servers'][$i]['favorite'] = 'pma__favorite'; $cfg['Servers'][$i]['history'] = 'pma__history'; $cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding'; $cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages'; $cfg['Servers'][$i]['recent'] = 'pma__recent'; $cfg['Servers'][$i]['relation'] = 'pma__relation'; $cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches'; $cfg['Servers'][$i]['table_coords'] = 'pma__table_coords'; $cfg['Servers'][$i]['table_info'] = 'pma__table_info'; $cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs'; $cfg['Servers'][$i]['tracking'] = 'pma__tracking'; $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig'; $cfg['Servers'][$i]['usergroups'] = 'pma__usergroups'; $cfg['Servers'][$i]['users'] = 'pma__users'; ?>root@dlp:~ # service php-fpm reload root@dlp:~ # service apache24 reload |
[4] | アクセスを許可したネットワーク内の任意のクライアントコンピューターで Web ブラウザーを起動し、[http://(サーバーのホスト名 または IP アドレス)/phpmyadmin/] にアクセスします。 すると phpMyAdmin の認証フォームが表示されるので、MariaDB に登録した任意のユーザーで認証してログインします。 |
[5] | ログインできました。この管理画面から MariaDB データベースを操作することができます。 |
Sponsored Link |