LoginSignup
0
0

More than 1 year has passed since last update.

Clear LinuxにWordpressを(その2)

Posted at

前回からの続き

前回はMariaDBをインストールして、WordPressというデータベースとwordpressuserというユーザを登録して準備完了というところまでだったかと思います。

WordPressのダウンロード

clear~ $ cd /var/www/html

clear/var/www/html $ sudo curl -O https://wordpress.org/latest.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 18.2M  100 18.2M    0     0  1149k      0  0:00:16  0:00:16 --:--:-- 1372k

clear/var/www/html $ sudo tar -xzvf latest.tar.gz 
パスワード: 
wordpress/
wordpress/xmlrpc.php
wordpress/wp-blog-header.php
・・・

ここまではよし。この後の画面でつまずいてしまいました。
前回設定したユーザ名でWordPressというデータベースにアクセスができません。

スクリーンショット 2022-02-07 23.49.06.png
WordPressデータベースのユーザ追加の設定ミスだと思われますが、間違えて設定したユーザ情報を消すのもphpMyAdminでやろうとするとうまくいきません。らちがあかないので結局mysqlでアクセスしてユーザを作り直すことに。はっきり言ってこっち(CLI)の方が楽です。

この部分の参考にさせていただいたのはこちらのページ:
https://sys-guard.com/post-18125/

clear~ $ mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 333
Server version: 10.6.5-MariaDB MariaDB Server

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)]> show databases;
+--------------------+
| Database           |
+--------------------+
| WordPress          |
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
5 rows in set (0.000 sec)

MariaDB [(none)]> select user, host FROM mysql.user ORDER by user;
+----------------+-----------+
| User           | Host      |
+----------------+-----------+
| mariadb.sys    | localhost |
| mysql          | localhost |
| root           | localhost |
+----------------+-----------+
5 rows in set (0.001 sec)

MariaDB [(none)]> grant ALL on WordPress.* TO 'wordpressuser'@'localhost' identified by 'wp-example';
Query OK, 0 rows affected (0.009 sec)

※ここでいきなりGRANT命令になっていますが、"wordpressuser"というユーザが存在しなければ作られないので心配ないということです。

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> select user, host from mysql.user order by user;
+----------------+-----------+
| User           | Host      |
+----------------+-----------+
| mariadb.sys    | localhost |
| mysql          | localhost |
| root           | localhost |
| wordpressuser  | localhost |
+----------------+-----------+
6 rows in set (0.001 sec)

MariaDB [(none)]> show grants for 'wordpressuser'@'localhost' ;
+----------------------------------------------------------------------------------------------------------------------+
| Grants for wordpressuser@localhost                                                                                   |
+----------------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO `wordpressuser`@`localhost` IDENTIFIED BY PASSWORD '*0729B792E6CA69E4B0CE7B01B2E1296056CCAE91' |
| GRANT ALL PRIVILEGES ON `WordPress`.* TO `wordpressuser`@`localhost`                                                 |
+----------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.000 sec)```

何がよくなかったのかよくわからないですが、とりあえずつながるようになりました。
つながるとこの画面になり、WordPressを設定できるようになります。
スクリーンショット 2022-02-07 22.49.26.png
ここからは作りたいサイトの情報を入力してそこのオーナー(管理者)ユーザを決めて、WordPressをインストールします。

スクリーンショット 2022-02-07 23.20.08.png
「WordPressをインストール」のボタンを押せば、サイトが一つできあがり。

参照リンク:
https://docs.01.org/clearlinux/latest/tutorials/wordpress.html#wp-install

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