(前回からの続き)
MySQLのインストール
Webアプリの要件がMySQL 5.7なので。
MariaDBをアンインストール
1 2 3 |
# yum list installed | grep mariadb mariadb-libs.x86_64 1:5.5.68-1.amzn2 installed # yum remove mariadb-libs |
mysql8.0リポジトリの追加 (mysql5.7も含まれている)
1 |
# yum localinstall https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm |
mysql8.0リポジトリの無効化
1 |
# yum-config-manager --disable mysql80-community |
mysql5.7リポジトリの有効化
1 |
# yum-config-manager --enable mysql57-community |
mysql5.7がインストールできるか確認
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# yum info mysql-community-server Available Packages Name : mysql-community-server Arch : x86_64 Version : 5.7.35 Release : 1.el7 Size : 174 M Repo : mysql57-community/x86_64 Summary : A very fast and reliable SQL database server URL : http://www.mysql.com/ License : Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. Under GPLv2 license as shown in the Description field. Description : The MySQL(TM) software delivers a very fast, multi-threaded, multi-user, : and robust SQL (Structured Query Language) database server. MySQL Server : is intended for mission-critical, heavy-load production systems as well : as for embedding into mass-deployed software. MySQL is a trademark of : Oracle and/or its affiliates : : The MySQL software has Dual Licensing, which means you can use the MySQL : software free of charge under the GNU General Public License : (http://www.gnu.org/licenses/). You can also purchase commercial MySQL : licenses from Oracle and/or its affiliates if you do not wish to be bound by the terms of : the GPL. See the chapter "Licensing and Support" in the manual for : further info. : : The MySQL web site (http://www.mysql.com/) provides the latest news and : information about the MySQL software. Also please see the documentation : and the manual for more information. : : This package includes the MySQL server binary as well as related utilities : to run and administer a MySQL server. |
インストール
1 2 3 |
# yum install mysql-community-server # mysqld --version mysqld Ver 5.7.35 for Linux on x86_64 (MySQL Community Server (GPL)) |
起動
1 2 |
# systemctl start mysqld.service # systemctl status mysqld.service |
デフォルトパスワードを調べる
1 2 |
# vi /var/log/mysqld.log 2021-09-01T05:33:58.488673Z 1 [Note] A temporary password is generated for root@localhost: xxxxxxxxxxxx |
パスワード変更
1 2 3 |
# mysql_secure_installation New password: xxxxxxxxxxxx Re-enter new password: xxxxxxxxxxxx |
アクセス確認
1 2 3 4 5 6 7 8 9 10 11 12 13 |
# mysql -u root -p Enter password: xxxxxxxxxxxx mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set (0.00 sec) mysql> exit; |
参考サイト
AWSのEC2で行うAmazon Linux2(MySQL5.7)環境構築 – Qiita
https://qiita.com/2no553/items/952dbb8df9a228195189
MySQLの初期パスワードのありか – Qiita
https://qiita.com/RyosukeSomeya/items/c695487588f5ac28d9f4