Tutorial on installing MySQL with Docker and implementing remote connection

Tutorial on installing MySQL with Docker and implementing remote connection

Pull the image

docker pull mysql

View the completed image

docker images

Create and start a MySQL container through the image

docker run --name mysql_dev -e MYSQL_ROOT_PASSWORD=123456 -p 3333:3306 -d mysql

–name: Name the newly created container, here named mysql_dev
-e: Configuration information, here configure the login password of the mysql root user
-p: port mapping, here map the host port 3333 to the container mysql_dev port 3306
-d: Output the complete ID of the container after successfully starting the container\The last mysql refers to the mysql image name

At this point, use navicat for mysql to connect to mysql and find an error:
Client does not support authentication protocol requested by server. . .
Solve it at the bottom ^ _ ^

View all installed containers

docker ps -a

View the started container

docker ps

Stop/start services in the container

docker stop mysql_dev
docker start mysql_dev

Entering the container

docker exec -it mysql_dev bash

View the IP address of the service in the container

docker exec -it mysql_dev cat /etc/hosts

The new version of MySQL reports an error when authorizing a user: near 'IDENTIFIED BY 'password' with grant option' at line 1

1 Question:

When using the grant permission list on the database to 'user name'@' access host' identified by 'password'; the error "......near 'identified by 'password'' at line 1" will appear

2 reasons:

Because the new version of MySQL has separated the way to create accounts and grant permissions

3 Solutions:

Create an account: create user 'user name'@'access host' identified by 'password';
Grant permissions: grant permission list on database to 'user name'@'access host'; (add with grant option at the end when modifying permissions)

4 Specific operations:

# Add user CREATE USER 'mysql_dev' IDENTIFIED BY '123456';
# Grant permissions GRANT ALL PRIVILEGES ON *.* TO 'mysql_dev'@'%';
# Modify encryption rules ALTER USER 'mysql_dev'@'%' IDENTIFIED BY '123456' PASSWORD EXPIRE NEVER;
# Update the user's password ALTER USER 'mysql_dev'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
# Update configuration information FLUSH PRIVILEGES;

The above is the details of the tutorial on how to install MySQL with Docker and realize remote connection. For more information about installing MySQL with Docker and realizing remote connection, please pay attention to other related articles on 123WORDPRESS.COM!

You may also be interested in:
  • Docker enables secure TLS remote connection access
  • How to set up vscode remote connection to server docker container
  • Docker deploys mysql remote connection to solve 2003 problems
  • Detailed example of remotely connecting to Docker using TLS encrypted communication
  • Docker deploys mysql to achieve remote connection sample code
  • Detailed explanation of docker daemon remote connection settings
  • Implementation example of Docker remote connection settings

<<:  Causes and solutions for MySQL deadlock

>>:  JavaScript to achieve text expansion and collapse effect

Recommend

Implementation of mysql8.0.11 data directory migration

The default storage directory of mysql is /var/li...

HTML Table Tag Tutorial (47): Nested Tables

<br />In the page, typesetting is achieved b...

React+axios implements github search user function (sample code)

load Request Success Request failed Click cmd and...

Vue uses drag and drop to create a structure tree

This article example shares the specific code of ...

Solution to garbled display of Linux SecureCRT

Let's take a look at the situation where Secu...

A few experiences in self-cultivation of artists

As the company's influence grows and its prod...

Docker dynamically exposes ports to containers

View the IP address of the Container docker inspe...

Detailed tutorial for installing ffmpeg under Linux

1. Install ffmpeg under centos linux 1. Download ...

How to configure Nginx load balancing

Table of contents Nginx load balancing configurat...

Let's talk about what JavaScript's URL object is

Table of contents Overview Hash Properties Host p...

Deployment and Chinese translation of the docker visualization tool Portainer

#docker search #docker pull portainer 1. Download...

Commonly used JavaScript array methods

Table of contents 1. filter() 2. forEach() 3. som...

Installation of CUDA10.0 and problems in Ubuntu

The correspondence between tensorflow version and...

Analyze MySQL replication and tuning principles and methods

1. Introduction MySQL comes with a replication so...

Share the pitfalls of MySQL's current_timestamp and their solutions

Table of contents MySQL's current_timestamp p...