先日より、macからwindowsにベースを移行しています。
まずは、昔から引きずっているサイトなどをローカル環境で動かせるようにしてみたいと思います。
新しいマシン自体のトラブルもあって、購入していきなりOSごとインストールし直すという中々スリリングな体験中。しっかりとしたメーカーだから変なことはないのでしょうが、いろいろ起きますね
WSL2ベースのubuntu20.04のインストール
これはそれほど、難しい話ではなく、コンソールを開いて以下のように入力
wsl --install
mysqlインストール
普通にやると、mysql8.0がインストールされます。ubuntu20.04ではそれが普通です。ただ、いろいろ過去のものを弄りたくない、そこまで冒険したくない思いもあって、mysql5.7を入れます。
$sudo apt-get update
$sudo apt-get install wget
$wget https://dev.mysql.com/get/mysql-apt-config_0.8.12-1_all.deb
$sudo dpkg -i mysql-apt-config_0.8.12-1_all.deb
ここまでやると設定画面が出てきます。
レポジトリの選択 ⇒ Ubuntu bionic
Which server? ⇒ mysql5.7
確認画面 ⇒ OK
これで終了です。間違えたら設定ごと削除します。
sudo dpkg -P mysql-apt-config # 間違えて削除したい場合です
あとは、インストールを進めます
$sudo apt-get update
$sudo apt-cache policy mysql-server
hashimoto@HP091:~$ sudo apt-cache policy mysql-server
mysql-server:
Installed: (none)
Candidate: 8.0.28-0ubuntu0.20.04.3
Version table:
8.0.28-0ubuntu0.20.04.3 500
500 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
8.0.19-0ubuntu5 500
500 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages
5.7.37-1ubuntu18.04 500
500 http://repo.mysql.com/apt/ubuntu bionic/mysql-5.7 amd64 Packages
インストール可能なバージョンが表示されるので、5.7.37-1ubuntu18.04を覚えておきます
まずは、-sをつけてインストールのシュミレーション
$sudo apt-get install -s mysql-client=5.7.37-1ubuntu18.04
エラーがなければ
$sudo apt-get install mysql-client=5.7.37-1ubuntu18.04
さらに、
$sudo apt-get install -s mysql-community-server=5.7.37-1ubuntu18.04
$sudo apt-get install mysql-community-server=5.7.37-1ubuntu18.04
$sudo apt-get install -s mysql-server=5.7.37-1ubuntu18.04
$sudo apt-get install mysql-server=5.7.37-1ubuntu18.04
途中で、rootのパスワードを聞かれますので、きちんと設定します
インストールの確認です
~$ mysql -V
mysql Ver 14.14 Distrib 5.7.37, for Linux (x86_64) using EditLine wrapper
これで一旦完了です。起動します
~$ sudo service mysql start
..
* MySQL Community Server 5.7.37 is started
~$ mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.37 MySQL Community Server (GPL)
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
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>
コメント