1.MariaDBにWordPressのDBを作成

MariaDBにWordPressのDBを作成
MariaDBにWordPressのDBを作成

WordPressのインストールに向けて、WordPressのDBを作成します。

WordPressで作成するブログの名前をtestとします。

そこでいろいろ作成する物をtestをキーワードに設定を行いますが、真似をする必要はありません

ブログが使用するDBを作成

作成DB

WordPressで作成するブログ向けに下記のDBを作成します。

作成DB
  • DB名:test
  • ユーザ名:test
  • パスワード:testuser001

MySQLコマンドでログイン

DBサーバにMySQLのコマンドでログインします。

$ sudo mysql -uroot -p
Enter password:            <=enterキー入力でOK
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 32
Server version: 11.8.3-MariaDB-0+deb13u1 from Debian -- Please help get to 10k stars at https://github.com/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)]>

ここからは、MySQLのコマンドの入力を説明します。

DBの作成

MariaDB [(none)]> create database test; <=DB作成
Query OK, 1 row affected (0.001 sec)


MariaDB [(none)]> show databases; <=作成DBの確認


+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| test               |
+--------------------+
5 rows in set (0.004 sec)

MariaDB [(none)]> select * from INFORMATION_SCHEMA.SCHEMATA where SCHEMA_NAME='test';
+--------------+-------------+----------------------------+------------------------+----------+----------------+
| CATALOG_NAME | SCHEMA_NAME | DEFAULT_CHARACTER_SET_NAME | DEFAULT_COLLATION_NAME | SQL_PATH | SCHEMA_COMMENT |
+--------------+-------------+----------------------------+------------------------+----------+----------------+
| def          | test        | utf8mb4                    | utf8mb4_uca1400_ai_ci  | NULL     |                |
+--------------+-------------+----------------------------+------------------------+----------+----------------+
1 row in set (0.000 sec)

ユーザ名とパスワード作成

MariaDB [(none)]> create user 'test'@localhost identified by 'testuser001';
Query OK, 0 rows affected (0.001 sec)

作成DBのアクセスを作成ユーザに許可

作成DBの全テーブルに対して、作成したユーザに全権限を付与します。

MariaDB [(none)]> grant all privileges on test.* to 'test'@'localhost';
Query OK, 0 rows affected (0.001 sec)

これから作成する全DBも含めて同じユーザでアクセスする時は

MariaDB [(none)]> grant all privileges on *.* to 'test'@'localhost';
Query OK, 0 rows affected (0.001 sec)

と指定してください。(手抜きです)

MySQLコマンドを終了します。

MariaDB [(none)]> exit
Bye
ももぶろ
ももぶろ

次はApache2です。

タイトルとURLをコピーしました