環境
ubuntu@ip-172-31-0-228:~$ uname -a Linux ip-172-31-0-228 4.4.0-1052-aws #61-Ubuntu SMP Mon Feb 12 23:05:58 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux ubuntu@ip-172-31-0-228:~$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 16.04.4 LTS Release: 16.04 Codename: xenial
準備
パッケージリスト更新、パッケージ更新
apt-get update apt-get upgrade
インストールできるmysql-serverのバージョン確認
ubuntu@ip-172-31-0-228:~$ apt-cache search mysql-server mysql-server - MySQL database server (metapackage depending on the latest version) mysql-server-5.7 - MySQL database server binaries and system database setup mysql-server-core-5.7 - MySQL database server binaries
標準は5.7。MySQLのAPTリポジトリを追加する必要あり。
MySQL リポジトリの追加
リポジトリとはなんぞや
- インターネット上でパッケージを配布しているサーバ
- リポジトリを登録する→パッケージ取得先サーバを登録する
リポジトリ登録
wget https://dev.mysql.com/get/mysql-apt-config_0.8.10-1_all.deb sudo dpkg -i mysql-apt-config_0.8.10-1_all.deb
"Configuring mysql-apt-config"でOKを選択して終了
パッケージリスト更新
ubuntu@ip-172-31-0-228:~$ sudo apt-get update Hit:1 http://repo.mysql.com/apt/ubuntu xenial InRelease Hit:2 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu xenial InRelease Hit:3 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu xenial-updates InRelease Hit:4 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu xenial-backports InRelease Get:5 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB] Fetched 102 kB in 1s (72.0 kB/s) Reading package lists... Done
"http://repo.mysql.com/apt/ubuntu"が更新されたことを確認
インストール
sudo apt-get install mysql-server
パスワード入力画面でrootユーザに設定するパスワード入力 その後、MySQLの認証方式を選択する。おためしのため推奨される新しい認証方式を採用
確認
起動確認
sudo service mysql status
バージョン確認
ubuntu@ip-172-31-0-228:~$ sudo mysqld --version /usr/sbin/mysqld Ver 8.0.11 for Linux on x86_64 (MySQL Community Server - GPL)
接続確認
mysql -u root -p
memo
- apt-get update
- パッケージリストの更新のみ。
- apt-get upgrade
- インストール済みパッケージの更新
- dpkg
- apt-cache
- パッケージの詳細を確認
showpkg
の結果に書かれている"Reverse Depends"は対象パッケージを必要とする、他のパッケージpolicy [パッケージ名]
でインストール可能なパッケージのバージョンが確認可能
参考
https://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/ https://qiita.com/white_aspara25/items/723ae4ebf0bfefe2115c