Scenario: After installing the latest version of MySQL in the Docker container of the virtual machine, the following error appears when using Navicat to connect to MySQL in the virtual machine on the host machine:
Solution: 1. First, use the docker ps command to check the running container to make sure that the mysql we want to connect to has been started. If it has not been started, use the docker start command to start it (the result in the figure below shows that a mysql has been started) 2. Then run docker exec -it b30062adc08c /bin/bash to enter the mysql container 3. Then enter the mysql -u root -p command, then enter your password, and finally enter the update password statement:
4. Finally, restart MySQL and use navicat to connect successfully. Supplementary knowledge: Solution to the error of local remote connection to MySQL in Docker (1251) The error is as follows: Reason: MySQL 8.0 uses the caching_sha2_password authentication mechanism by default; the client does not support the new encryption method Solution: Modify the encryption method of the user (root) 1. Enter the mysql container and enter in docker
2. Log in to MySQL
As shown in the picture, enter 123456 and press Enter. 3. Set user configuration items (1) View user information
(2) Modify the encryption method
(3) Check user information again
(4) Use Navicate or other database software to connect again, success (5) Supplement: If you want to exit normally without closing the container, you can exit the container by pressing Ctrl+P+Q Exit the mysql container: Ctrl+D, press twice The above solution to the failure to connect to mysql in docker is all the content that the editor shares with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Mysql optimization tool (recommended)
>>: Detailed explanation of the difference between JavaScript onclick and click
Recently, when I installed MySQL in Docker, I fou...
The problem raised in the title can be broken dow...
I used ECharts when doing a project before. Today...
A must-have for interviews, you will definitely u...
Table of contents 1. Swap partition SWAP 1.1 Crea...
1. Write the Dockerfile (1) Right-click the proje...
Table of contents Preface Check and uninstall Ope...
You can add comments to MySQL SQL statements. Her...
Table of contents background Technical Solution S...
1. Data desensitization explanation In daily deve...
This reading note mainly records the operations r...
When you write buttons (input, button), you will f...
Preface To be honest, I've been feeling very ...
When I configured mysql, I set the default storag...
This article uses an example to describe the MySQ...