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 1 year has passed since last update.

年末はおうちでゆっくり WAF を楽しもうAdvent Calendar 2022

Day 12

Ubuntu 22.04 + Nginx 1.22.1 + MariaDB 10.6.11 + PHP 8.1 - MariaDB設定

Last updated at Posted at 2022-12-12

前提

WordPress をインストールする前に WordPress 用の DB を構築するよ。

環境

Ubuntu 22.04
Nginx 1.22.1
MariaDB 10.6.11

MariaDB のインストールはこっちを見てね。

設定

設定前の確認

$ sudo mysql -u root -p

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.016 sec)

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

データベースの作成

MariaDB [(none)]> create database wordpress;

ユーザの作成

MariaDB [(none)]> create user 'wpuser'@'localhost' identified by 'p@ssw0rd';

アクセス権の付与(特権ユーザ)

MariaDB [(none)]> grant all on wordpress.* to 'wpuser'@'localhost' with grant option;

確認

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| wordpress          |
+--------------------+
5 rows in set (0.002 sec)

MariaDB [(none)]> select user,host from mysql.user;
+-------------+-----------+
| User        | Host      |
+-------------+-----------+
| mariadb.sys | localhost |
| mysql       | localhost |
| root        | localhost |
| wpuser      | localhost |
+-------------+-----------+
4 rows in set (0.002 sec)

設定保存

MariaDB [(none)]> flush privileges;
MariaDB [(none)]> quit
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?