7
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MacでDockerにMysql作成から接続まで

Last updated at Posted at 2019-03-12

#1.インストール
(1).イメージのプル
docker pull mysql
(2).イメージのプルの結果確認
docker images
(3).コンテナ作成・起動
docker run --name ly-mysql -e MYSQL_ROOT_PASSWORD=123456 -p 3306:3306 -d mysql
#2.MySQLWorkbench接続
(1).コンテナの接続
docker exec -it ly-mysql bash
(2).mysqlの接続

(3).リモート接続ユーザー作成
```CREATE USER 'user'@'%' IDENTIFIED WITH mysql_native_password BY '123';```
(4).権限付与
```GRANT ALL PRIVILEGES ON ```*.*``` TO 'user'@'%';```
```flush privileges;```
#3.Mysql再起動
(1).終止コンテナ検索
```docker ps -a```
(2).コンテナ起動
```docker start コンテナID```
(3).コンテナ削除
```docker rm コンテナID```


7
7
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
7
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?