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.

AWS/EC2にてMySQLを設定してみます

Last updated at Posted at 2020-04-27

AWS EC2 のMySQLにてユーザの許可を設定していきます。

1 . EC2/Linuxでmariabdbがあるかどうか

yum list installed | grep mariadb

2 . MySQLが存在するか

yum list installed | grep mysql

3 . yumにRepository mysql8.0(version 5.7含む)

yum localinstall https://dev.mysql.com/get/mysql80-com... -y

4 . mysql 5.7インストールするので、 mysql 5.8を無効にする

yum-config-manager --disable mysql80-community

5 . mysql 5.7有効

yum-config-manager --enable mysql57-community

6 . 情報確認

yum info mysql-community-server

7 . 設定

yum install mysql-community-server -y

8 . version確認

mysqld --version 

9 . 起動

systemctl start mysqld.service

10 . 自動起動

systemctl enable mysqld.service

11 . 状態確認

systemctl status mysqld.service

12 . rootのパスワード確認

cat /var/log/mysqld.log | grep password

13 . 初期設定

mysql_secure_installation

14 . charset確認

mysql -uroot -p
show global variables like 'character%';

15 . default charset設定

vi /etc/my.cnf
[mysqld]
character_set_server=utf8

[client]
default-character-set=utf8

16 . database作成

create database db_test character set UTF8 collate utf8_bin;

17 . local user作成

CREATE USER 'test'@'localhost' IDENTIFIED BY 'Adsasdf123@!';

許可設定

mysql> GRANT ALL PRIVILEGES ON db_test.* TO 'test'@'localhost';

18 . remote user作成

CREATE USER 'remote_user'@'%' IDENTIFIED BY 'Adsasdf123@!';
mysql> GRANT ALL PRIVILEGES ON db_test.* TO 'remote_user'@'%';

19 . firewall port 3306 開き

接続確認します。

以上!

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?