13
12

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

AWS Amazon LinuxにMySQL5.7をインストール

Last updated at Posted at 2017-07-31

前回の続き

サーバーはAWSのAmazon Linuxを利用。
php7.1 / nginx(fast CGI)
http://qiita.com/namixc/items/17c3617f247057d911cb

MySQLのインストール

Jsonが扱えるバージョン5.7を入れる。

sudo yum -y install http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm`
sudo yum -y install mysql-community-server

バージョン確認

mysql --version
mysql  Ver 14.14 Distrib 5.7.19, for Linux (x86_64) using  EditLine wrapper

自動起動の設定
sudo chkconfig mysqld on

MySQLを起動

$ sudo service mysqld start
Initializing MySQL database:                               [  OK  ]
Starting mysqld:                                           [  OK  ]

root@localhostのパスワードがログファイルの中にあるので確認する。

/var/log/mysqld.log
[Note] A temporary password is generated for root@localhost: [これ]

パスワードを使ってMySQLにログインする。
初期のパスワードを変更しないとエラーが出続けるのでパスワードを変更しておく。

  • 「8文字以上、英字・数字・記号をそれぞれ1つ以上含む」というかなり強固なパスワードを要求されるので注意
$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.7.19

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> ALTER USER root@localhost IDENTIFIED BY '新パスワード';

my.cnfの編集

/etc/my.cnf
character-set-server = utf8 #追加

MySQL再起動

sudo service mysqld restart

13
12
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
13
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?