MariaDBインストールと設定

CentOS8
このサイトはアフィリエイト広告(Amazonアソシエイト含む)を掲載しています。

データベースを構築するためにMariaDBをインストールする

インストール

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
dnf install mariadb-server
dnf install mariadb-server
dnf install mariadb-server

バージョン確認

今回インストールしたバージョンは10.3.27

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
mysql -V
mysql Ver 15.1 Distrib 10.3.27-MariaDB, for Linux (x86_64) using readline 5.1
mysql -V mysql Ver 15.1 Distrib 10.3.27-MariaDB, for Linux (x86_64) using readline 5.1
mysql -V
mysql  Ver 15.1 Distrib 10.3.27-MariaDB, for Linux (x86_64) using readline 5.1

サービス起動・自動起動

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
systemctl start mariadb
systemctl enable mariadb
systemctl status mariadb
systemctl start mariadb systemctl enable mariadb systemctl status mariadb
systemctl start mariadb
systemctl enable mariadb
systemctl status mariadb

設定

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
mysql_secure_installation
mysql_secure_installation
mysql_secure_installation
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
Enter current password for root (enter for none): ← Enterを押す
Set root password? [Y/n] ← Enterを押す
New password: ← パスワードを設定
Re-enter new password: ← パスワードを設定
Remove anonymous users? [Y/n] ← Enterを押す
Disallow root login remotely? [Y/n] ← Enterを押す
Remove test database and access to it? [Y/n] ← Enterを押す
Reload privilege tables now? [Y/n] ← Enterを押す
Enter current password for root (enter for none): ← Enterを押す Set root password? [Y/n] ← Enterを押す New password: ← パスワードを設定 Re-enter new password: ← パスワードを設定 Remove anonymous users? [Y/n] ← Enterを押す Disallow root login remotely? [Y/n] ← Enterを押す Remove test database and access to it? [Y/n] ← Enterを押す Reload privilege tables now? [Y/n] ← Enterを押す
Enter current password for root (enter for none): ← Enterを押す

Set root password? [Y/n] ← Enterを押す
New password: ← パスワードを設定
Re-enter new password: ← パスワードを設定


Remove anonymous users? [Y/n] ← Enterを押す
Disallow root login remotely? [Y/n] ← Enterを押す

Remove test database and access to it? [Y/n] ← Enterを押す
Reload privilege tables now? [Y/n] ← Enterを押す

ログイン確認

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
mysql -u root -p
Enter password: ← パスワードを入力
mysql -u root -p Enter password: ← パスワードを入力
mysql -u root -p
Enter password: ← パスワードを入力


下記のように表示されればログインできている

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 22
Server version: 10.3.27-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)]>
Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 22 Server version: 10.3.27-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)]>
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 22
Server version: 10.3.27-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)]>


コメント

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