概要
前回の続きとして今回はPhpMyAdminといいうツールをインストールのメモです。
PhpMyAdminというのはWEBのブラウザからMySQLを管理するときによく使われるツールです。
とりあえずインストールしてみましょう。
PhpMyAdminのインストール
下記のインストールコマンドからインストールします。
①インストールコマンド
sudo apt-get install phpmyadmin
②実行結果
pi@RPI3B:~ $ sudo apt-get install phpmyadmin
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
dbconfig-common dbconfig-mysql icc-profiles-free libjs-codemirror libjs-jquery-metadata libjs-jquery-mousewheel
libjs-jquery-tablesorter libjs-jquery-timepicker libmcrypt4 php-bz2 php-composer-ca-bundle php-fig-http-message-util
php-getallheaders php-google-recaptcha php-mariadb-mysql-kbs php-mysql php-nikic-fast-route php-phpmyadmin-motranslator
php-phpmyadmin-shapefile php-phpmyadmin-sql-parser php-psr-cache php-psr-container php-psr-http-factory
php-psr-http-message php-psr-log php-slim-psr7 php-symfony-cache php-symfony-cache-contracts php-symfony-config
php-symfony-dependency-injection php-symfony-deprecation-contracts php-symfony-expression-language php-symfony-filesystem
php-symfony-polyfill-php80 php-symfony-service-contracts php-symfony-var-exporter php-tcpdf php-twig
php-twig-i18n-extension php-webmozart-assert php7.1-common php7.1-mcrypt php8.3-bz2
Suggested packages:
libjs-requirejs libmcrypt-dev mcrypt php-apcu php-dbase php-symfony-yaml php-symfony-finder
php-symfony-proxy-manager-bridge php-imagick php-twig-doc php-recode php-gd2 php-pragmarx-google2fa-qrcode
php-bacon-qr-code php-code-lts-u2f-php-server php-web-auth-webauthn-lib
The following NEW packages will be installed:
dbconfig-common dbconfig-mysql icc-profiles-free libjs-codemirror libjs-jquery-metadata libjs-jquery-mousewheel
libjs-jquery-tablesorter libjs-jquery-timepicker libmcrypt4 php-bz2 php-composer-ca-bundle php-fig-http-message-util
php-getallheaders php-google-recaptcha php-mariadb-mysql-kbs php-mysql php-nikic-fast-route php-phpmyadmin-motranslator
php-phpmyadmin-shapefile php-phpmyadmin-sql-parser php-psr-cache php-psr-container php-psr-http-factory
php-psr-http-message php-psr-log php-slim-psr7 php-symfony-cache php-symfony-cache-contracts php-symfony-config
php-symfony-dependency-injection php-symfony-deprecation-contracts php-symfony-expression-language php-symfony-filesystem
php-symfony-polyfill-php80 php-symfony-service-contracts php-symfony-var-exporter php-tcpdf php-twig
php-twig-i18n-extension php-webmozart-assert php7.1-common php7.1-mcrypt php8.3-bz2 phpmyadmin
0 upgraded, 44 newly installed, 0 to remove and 0 not upgraded.
Need to get 15.9 MB of archives.
After this operation, 76.8 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
⑦インストール終了しました。
※最後に「Error: Timeout was reached」が表示されているのは原因が分からないです。
Setting up php-webmozart-assert (1.11.0-1) ...
Setting up php-twig (3.5.1-1) ...
Setting up php-psr-log (1.1.4-2) ...
Setting up php-nikic-fast-route (1.3.0-4) ...
Setting up libjs-jquery-tablesorter (1:2.31.3+dfsg1-3) ...
Setting up php-symfony-polyfill-php80 (1.27.0-2) ...
Setting up libjs-jquery-timepicker (1.6.3-4) ...
Setting up php8.3-bz2 (8.3.9-1+0~20240708.36+debian12~1.gbp429c36) ...
Creating config file /etc/php/8.3/mods-available/bz2.ini with new version
Setting up php-google-recaptcha (1.2.4-5) ...
Setting up php-symfony-var-exporter (5.4.23+dfsg-1+deb12u2) ...
Setting up libmcrypt4 (2.5.8-7) ...
Setting up php-psr-http-message (1.0.1-3) ...
Setting up php-symfony-deprecation-contracts (2.5.2-1+deb12u1) ...
Setting up php-twig-i18n-extension (4.0.1-2) ...
Setting up php-symfony-cache-contracts (2.5.2-1+deb12u1) ...
Setting up php-tcpdf (6.6.2+dfsg1-1) ...
Setting up php-bz2 (2:8.3+94+0~20240205.51+debian12~1.gbp6faa2e) ...
Setting up php7.1-mcrypt (7.1.33-63+0~20240606.93+debian12~1.gbpa08c53) ...
Creating config file /etc/php/7.1/mods-available/mcrypt.ini with new version
Setting up dbconfig-mysql (2.0.24) ...
Setting up php-symfony-service-contracts (2.5.2-1+deb12u1) ...
Setting up php-symfony-cache (5.4.23+dfsg-1+deb12u2) ...
Setting up php-symfony-expression-language (5.4.23+dfsg-1+deb12u2) ...
Setting up php-phpmyadmin-sql-parser (5.7.0-2) ...
Setting up php-symfony-config (5.4.23+dfsg-1+deb12u2) ...
Setting up php-psr-http-factory (1.0.1-3) ...
Setting up php-symfony-dependency-injection (5.4.23+dfsg-1+deb12u2) ...
Setting up php-slim-psr7 (1.6.1-1) ...
Setting up php-phpmyadmin-motranslator (5.3.0-1) ...
Setting up phpmyadmin (4:5.2.1+dfsg-1) ...
Determining localhost credentials from /etc/mysql/debian.cnf: succeeded.
dbconfig-common: writing config to /etc/dbconfig-common/phpmyadmin.conf
Creating config file /etc/dbconfig-common/phpmyadmin.conf with new version
Creating config file /etc/phpmyadmin/config-db.php with new version
checking privileges on database phpmyadmin for phpmyadmin@localhost: user creation needed.
granting access to database phpmyadmin for phpmyadmin@localhost: success.
verifying access for phpmyadmin@localhost: success.
creating database phpmyadmin: success.
verifying database phpmyadmin exists: success.
populating database via sql... done.
dbconfig-common: flushing administrative password
apache2_invoke: Enable configuration phpmyadmin
Processing triggers for libapache2-mod-php8.3 (8.3.9-1+0~20240708.36+debian12~1.gbp429c36) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for libc-bin (2.36-9+rpt2+deb12u7) ...
Processing triggers for man-db (2.11.2-2) ...
Processing triggers for php8.3-cli (8.3.9-1+0~20240708.36+debian12~1.gbp429c36) ...
Error: Timeout was reached
DBの接続ユーザを追加
下記のコマンドをSQLコマンドラインから実行います。
①コマンド一覧
●sudo mysql
→root権限でMysqlを接続(パスワードが未設定の状態)
●CREATE USER 'userid'@'localhost' IDENTIFIED BY 'password';
→新規ユーザを追加する
●GRANT ALL PRIVILEGES ON * . * TO 'userid'@'localhost';
→新規で追加したユーザにすべての権限を付与します。
●FLUSH PRIVILEGES;
→上記のユーザ追加の内容をDBに反映するコマンドです。
②実行結果
pi@RPI3B:~ $ sudo mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 47
Server version: 10.11.3-MariaDB-1+rpi1 Raspbian 12
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> CREATE USER 'laravel'@'localhost' IDENTIFIED BY 'Passw0rd';
Query OK, 0 rows affected (0.005 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON * . * TO 'laravel'@'localhost';
Query OK, 0 rows affected (0.004 sec)
MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.003 sec)
③追加したユーザIDでDB接続を確認します。
pi@RPI3B:~ $ sudo mysql -u userid -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 48
Server version: 10.11.3-MariaDB-1+rpi1 Raspbian 12
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> exit
Bye
pi@RPI3B:~ $
PhpMyAdminへ接続
下記のアドレスからアクセスします。
http://[raspbery pi ip address/phpmyadmin/
③これでphpMyAdminのインストール及び接続は完了です。
終わりに
久しぶりにRPI3BでPhpMyAdminもインストールしてみました。
次からは少しずつコードを書いていきます。
今日はここまでです!ありがとうございます。