[28000][1045] Access denied for user 'root'@'xxx.xxx.xxx.xxx' (using password: YES) #1114
Scxw010516
started this conversation in
General
Replies: 2 comments 3 replies
-
Was the mount for the mysql data ( |
Beta Was this translation helpful? Give feedback.
2 replies
-
I can't reproduce with your config as-is (removed only the port mapping, explicit network, and the $ find -ls
40794332 4 drwxr-xr-x 4 tianon tianon 4096 Jun 24 14:08 .
40794727 4 drwxr-xr-x 2 tianon tianon 4096 Jun 24 14:08 ./data
40794726 4 drwxr-xr-x 2 tianon tianon 4096 Jun 24 14:07 ./conf
40793695 4 -rw-r--r-- 1 tianon tianon 331 Jun 24 14:07 ./conf/foo.cnf
40794346 4 -rw-r--r-- 1 tianon tianon 221 Jun 24 14:06 ./docker-compose.yml
$ cat docker-compose.yml
mysql:
image: mysql:latest
container_name: mysql
environment:
MYSQL_ROOT_PASSWORD: fUt8uxRCj#^TKoH
TZ: Asia/Shanghai
volumes:
- "./conf:/etc/mysql/conf.d"
- "./data:/var/lib/mysql"
$ cat conf/foo.cnf
[client]
default_character_set=utf8mb4
[mysql]
default_character_set=utf8mb4
[mysqld]
server-id = 1
log-bin=mysql-bin
binlog_expire_logs_seconds = 2592000
sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'
max_connections=1000
symbolic-links=0
default-time_zone = '+8:00'
$ docker-compose up -d
Creating mysql ... done
$ docker exec mysql mysql -uroot -p'fUt8uxRCj#^TKoH' -e 'SELECT 1'
mysql: [Warning] Using a password on the command line interface can be insecure.
1
1
$ docker restart mysql
mysql
$ docker exec mysql mysql -uroot -p'fUt8uxRCj#^TKoH' -e 'SELECT 1'
mysql: [Warning] Using a password on the command line interface can be insecure.
1
1 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm currently encountering a problem.
I'm using the
mysql:latest
image (which should be 9.3.0), and I'm using the followingdocker-compose.yml
configuration to start my container. At this time, everything is working normally, and my Datagrip can connect properly.But when I restarted MySQL with
docker restart mysql
, I encountered the problem[28000][1045] Access denied for user 'root'@'192.168.137.1' (using password: YES)
. Then, I entered the MySQL container, but I also failed[28000][1045] Access denied for user 'root'@'localhost' (using password: YES)
.I tried the above steps many times, but I encountered the same problem.But when I switched to
mysql:8.3.0
, this problem disappeared.Here is my
docker-compose.yml
:And my .cnf file:
Beta Was this translation helpful? Give feedback.
All reactions