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 3 years have passed since last update.

【MariaDB】LinuxにMariaDBをインストールして、DBと操作ユーザーを作成する

Last updated at Posted at 2020-11-14

AWSにて、Linux2のEC2をDBサーバーとして使おうとMariaDBをインストールしたときのメモです。(圧倒的自分用)

まずは何はともあれ

sudo yum update -y

mariaDBのインストール

sudo yum -y install mariadb-server

mariaDB起動

sudo systemctl start mariadb

DBのrootアカウントのパスワードを設定

mysqladmin -u root password

rootアカウントで、設定したパスワードにてDBにログイン

mysql -u root -p

{データベース名}でDBを作成

CREATE DATABASE {データベース名} DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

作成した{データベース名}DBへの全操作権限を付与したユーザーを
{ユーザー名}と{パスワード}で作成

grant all on {データベース名}.* to {ユーザー名}@"%" identified by '{パスワード}';

次回以降、サーバ起動時にmariaDBも自動で起動するように設定

sudo systemctl enable mariadb
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?