카테고리 없음

[Docker][MySQL]Access denied for user ‘’@’172.17.0.1'(using password: YES)

[czar] 2021. 1. 8. 19:25

[Docker][MySQL]Access denied for user ‘’@’172.17.0.1'(using password: YES)

 

Solution:

Step 1: access MySQL through docker container

docker exec -it <CONTAINER_ID> mysql -uroot -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 360

Server version: 8.0.21 MySQL Community Server - GPL

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates.

Other names may be trademarks of their respectiveowners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

 

Step 2:

mysql> CREATE USER 'username'@'172.17.0.1' IDENTIFIED BY 'password';

Step 3:

mysql> GRANT ALL PRIVILEGES ON *.* TO 'username'@'172.17.0.1' WITH GRANT OPTION;

Step 4 :

mysql> flush privileges;
mysql> exit

 

 

접속 하기