ubuntuにMySQL Community Editionをインストールします。

スポンサーリンク

以前RHEL8にMySQL Community Editionをインストールしました。
https://minokamo.tokyo/2021/04/18/3596/
本日は、ubuntuにインストールします。公式リポジトリを使ってインストールします。
https://dev.mysql.com/downloads/
OSがubuntuなのでMySQL APT repositoryのリンクをクリックします。


次のページでDownloadボタンをクリックして進みます。ここでは登録やログインをすることはせず、「No thanks , just start my download.」のリンクアドレスを右クリックして取得します。

ここからはクラウドやローカルなどに作成したubuntuのコンソール画面による操作になります。先ほど取得したリンクアドレスのファイルをダウンロードしてから、debパッケージをインストールします。

wget https://dev.mysql.com/get/mysql-apt-config_0.8.17-1_all.deb
sudo dpkg -i ./mysql-apt-config_0.8.17-1_all.deb

Package configurationのカラー画面が表示されたら、どれもclusterではなくServerを選択して進みます。


これでcommunity serverをインストールする準備が整いました。インストールします。
インストールの途中でカラー画面が表示されるのでrootのパスワードを決めます。「Select default authentication plugin」と聞かれたので「Use Legacy Authentication Method」を選択しました。テスト環境なので、データベース作成時に複雑なパスワードの使用を避けるためです。

sudo apt-get install mysql-community-server

インストール完了後に、初期設定をします。

/usr/bin/mysql_secure_installation
Securing the MySQL server deployment.

Enter password for user root:

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?

Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2
Using existing password for root.

Estimated strength of the password: 25
Change the password for root ? ((Press y|Y for Yes, any other key for No) : n

 ... skipping.
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
 - Dropping test database...
Success.

 - Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done!

最後にデータベースサーバーに接続します。

mysql -u root -p

コメント

タイトルとURLをコピーしました