LoginSignup
2
2

More than 5 years have passed since last update.

DockerでMySQLをインストール

Posted at

概要

DockerでMySQLを立ち上げ、接続する。

環境

  • Ubuntu 16.4

手順

インストール、起動

sudo apt install docker.io

# 実行ユーザーをdockerグループにいれて実行
docker run --name mysql -e MYSQL_ROOT_PASSWORD=mysql -d -p 3306:3306 mysql --default-authentication-plugin=mysql_native_password

補足

--default-authentication-pluginを指定しないと、接続時に下記のエラーが発生する。

ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/lib/mysql/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory

接続

sudo apt install mysql-client

mysql -h 127.0.0.1  -uroot -pmysql
2
2
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
2
2