0
0

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 3 years have passed since last update.

Laradockで立ち上げたmysqlコンテナでログインできないときの解決法

Posted at

#出たエラー


laradock>docker-compose exec mysql /bin/bash
root@hoge:/# mysql -u root
Access denied for user 'root'@'localhost' (using password: NO)

laradockの.envファイルで

laradock/.env
### MYSQL #################################################

MYSQL_VERSION=5.7
MYSQL_DATABASE=default
MYSQL_USER=default
MYSQL_PASSWORD=secret
MYSQL_PORT=3306
MYSQL_ROOT_PASSWORD=root
MYSQL_ENTRYPOINT_INITDB=./mysql/docker-entrypoint-initdb.d

これのMYSQL_ROOT_PASSWORDを使えばログインできます。(この場合root)
つまり、


laradock>docker-compose exec mysql /bin/bash
root@hoge:/# mysql -u root -p
Enter password: rootと打つ

で行けました。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?