Table of Contents
MySQLのインストール
バージョン確認
# dnf info mysql
利用可能なパッケージ
名前 : mysql
バージョン : 8.0.21
インストール
関連パッケージもインストールを行なうグループ指定(@)
# dnf install @mysql
起動設定
# systemctl enable mysqld
# systemctl start mysqld
初期設定
# mysql_secure_installation
Press y|Y for Yes, any other key for No: y
※VALIDATE PASSWORDを変更するのでy
Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0
※社内なのでLOW、通常はSTRONGがいいかも
New password:(設定したいパスワードを入力)
Re-enter new password:(設定したいパスワードを再入力)
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
※設定したパスワードで続行するのでy
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
※匿名ユーザーは不要なのでy
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
※rootでリモートログインはしないのでy
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
※テスト用のデータベースは不要なのでy
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
※ここまでの設定を反映させたいのでy
ポートのオープン
# firewall-cmd --zone=internal --add-service=mysql --permanent
# firewall-cmd --reload
# firewall-cmd --list-all --zone=internal
動作確認
rootのログオン
# mysql -u root -p
Enter password:(rootのパスワード)
ユーザの作成
mysql> CREATE USER 'hoge'@'localhost' IDENTIFIED BY '(パスワード)';
権限の付与
mysql> grant select,insert,delete,update,create,drop,file,alter,index on *.* to hoge@localhost;