docker-library / mysql

Docker Official Image packaging for MySQL Community Server
https://dev.mysql.com/
GNU General Public License v2.0
2.47k stars 2.19k forks source link

Access denied for user 'root'@'172.17.0.1' (using password: YES) #217

Closed eldermoraes closed 8 years ago

eldermoraes commented 8 years ago

Hi,

I have just created a new container with this command:

docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=myql -d mysql:latest

When I try to connect with MySQL Workbench (using localhost) I get the message:

Access denied for user 'root'@'172.17.0.1' (using password: YES)

Any help?

ltangvald commented 8 years ago

The above works for me. You're sure you're entering the correct password (it's myql, not mysql)?

eldermoraes commented 8 years ago

Shame on me! Sorry...

ltangvald commented 8 years ago

np :)

rcarmonad commented 5 years ago

1 hour with the same problem and it WAS the password.

manishsinh commented 4 years ago

ERROR 1130 (HY000): Host '172.17.0.1' is not allowed to connect to this MySQL server

got the same problem but not because of password

cccccong commented 4 years ago

Why is IP 172.17.0.1 different from what I set

htnphu commented 1 year ago

lol, anybody help me with this problem :((

htnphu commented 1 year ago

To fix this, you need to create a new user with access from 172.17.0.1. If you do not want to allow root connections from 172.17.0.1, you can create a new user with access from that IP address.

To do this, connect to your MySQL server as the root user and run the following command:

  1. CREATE USER 'localhost'@'172.17.0.1' IDENTIFIED BY 'your_new_password';
  2. GRANT ALL PRIVILEGES ON [your_db_to_connect].* TO 'localhost'@'172.17.0.1';

Once you have granted the new user the necessary privileges, you can use it to connect to your MySQL server from 172.17.0.1.

const connection = mysql.createConnection({ host: "localhost", port: port, user: "your_user", password: "your_new_password", database: "your_db_to_connect", });

buithanhlong091295 commented 1 year ago

To fix this, you need to create a new user with access from 172.17.0.1. If you do not want to allow root connections from 172.17.0.1, you can create a new user with access from that IP address.

To do this, connect to your MySQL server as the root user and run the following command:

  1. CREATE USER 'localhost'@'172.17.0.1' IDENTIFIED BY 'your_new_password';
  2. GRANT ALL PRIVILEGES ON [your_db_to_connect].* TO 'localhost'@'172.17.0.1';

Once you have granted the new user the necessary privileges, you can use it to connect to your MySQL server from 172.17.0.1.

const connection = mysql.createConnection({ host: "localhost", port: port, user: "your_user", password: "your_new_password", database: "your_db_to_connect", });

thank you so much bro, I wasted a whole day for this f*cking problem, you're my hero