How to solve the problem of slow Mysql connection in Docker

PHPz
Release: 2024-02-19 15:09:51
forward
551 people have browsed it

After using Docker to deploy MySQL, the connection speed is slow. Through online search, I found that the problem may be caused by the lack of DNS resolution and other modules during the minimum container installation.

How to solve the problem of slow Mysql connection in Docker

So there will be a problem of super slow connection when connecting, we directly add this sentence

skip-name-resolve
Copy after login

We directly modify the docker-compose.yml configuration, the configuration is as follows

version: "3"
services:
mysql:
image: mysql:latest
container_name: mysql_compose
restart: always
ports:
- 3306:3306
command: --default-authentication-plugin=mysql_native_password --skip-name-resolve
environment:
- MYSQL_ROOT_PASSWORD=test
volumes:
- /home/data/mysql:/var/lib/mysql
Copy after login

Re-execute, so the speed will be improved.

The above is the detailed content of How to solve the problem of slow Mysql connection in Docker. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:mryunwei.com
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