Home > Operation and Maintenance > Docker > What to do if the connection to mysql in docker fails

What to do if the connection to mysql in docker fails

王林
Release: 2020-05-21 11:39:53
Original
5167 people have browsed it

What to do if the connection to mysql in docker fails

Problem description:

When using navicat in the host to connect to mysql in the virtual machine, the following error message appears:

What to do if the connection to mysql in docker fails

Solution:

1. First use the docker ps command to check the running container and make sure that the mysql we want to connect to has been started. If not, use docker start Command startup (the result shown in the picture below indicates that a mysql has been started)

What to do if the connection to mysql in docker fails

2. Then run the docker exec -it b30062adc08c /bin/bash commandEnter the mysql container

3. Then enter the mysql -u root -p command, then enter your own password, and finally enter the update password statement: ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY ' 123456';

What to do if the connection to mysql in docker fails

4. Finally, restart mysql and use navicat to connect successfully

What to do if the connection to mysql in docker fails

Recommended tutorial:docker tutorial

The above is the detailed content of What to do if the connection to mysql in docker fails. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template