Table of Contents
Step 1: Download the mysql mirror
Step 2: Start the mysql mirror
The third step: Query the started image
The fourth step Step: Enter the container
Step 5: Log in to mysql
Step 6: Set up remote access
Step 7: Navicat Link Times 2059 Error
Home Database Mysql Tutorial How to install mysql8 and configure remote connection with docker under Linux

How to install mysql8 and configure remote connection with docker under Linux

Jun 02, 2023 pm 10:07 PM
mysql linux docker

Step 1: Download the mysql mirror

docker pull mysql
Copy after login

The default is to download the latest stable version

Step 2: Start the mysql mirror

docker run --name dockermysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=mysqlpassword -d mysql
Copy after login
  • --name is the alias of the image

  • -p maps 3306 to 3306 (docker is a virtual machine with its own port)

  • -e MYSQL_ROOT_PASSWORD=mysqlpassword Set the mysql server password (required later, be sure to remember)

  • -d Backend startup

  • Start the mirror name (can Replace with id)

The third step: Query the started image

docker ps
Copy after login

is as follows:

How to install mysql8 and configure remote connection with docker under Linux

The fourth step Step: Enter the container

docker exec -it dockermysql bash
Copy after login

dockermysql is the name of the image, you can use id instead

Step 5: Log in to mysql

mysql -u root -p
Copy after login

and enter the password set above

Step 6: Set up remote access

Switch database (the default should be this, it’s okay not to switch, just switch it to be on the safe side)

use mysql;
Copy after login

Change remote link authorization

grant all privileges on *.* to 'root'@'%';
Copy after login

The reason for the error is a problem with the encryption method

Check it:

select Host,User,plugin from user;
Copy after login

The result before modification is as follows:

How to install mysql8 and configure remote connection with docker under Linux

Execute the modification command:

alter user 'root'@'%' identified with mysql_native_password by 'yourPassword';
Copy after login

Change it to your mysql password

The result after successful modification is as follows:

How to install mysql8 and configure remote connection with docker under Linux

The above is the detailed content of How to install mysql8 and configure remote connection with docker under Linux. For more information, please follow other related articles on the PHP Chinese website!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to solve the permissions problem encountered when viewing Python version in Linux terminal? How to solve the permissions problem encountered when viewing Python version in Linux terminal? Apr 01, 2025 pm 05:09 PM

Solution to permission issues when viewing Python version in Linux terminal When you try to view Python version in Linux terminal, enter python...

Why does an error occur when installing an extension using PECL in a Docker environment? How to solve it? Why does an error occur when installing an extension using PECL in a Docker environment? How to solve it? Apr 01, 2025 pm 03:06 PM

Causes and solutions for errors when using PECL to install extensions in Docker environment When using Docker environment, we often encounter some headaches...

The page is blank after PHP is connected to MySQL. What is the reason for the invalid die() function? The page is blank after PHP is connected to MySQL. What is the reason for the invalid die() function? Apr 01, 2025 pm 03:03 PM

The page is blank after PHP connects to MySQL, and the reason why die() function fails. When learning the connection between PHP and MySQL database, you often encounter some confusing things...

How to efficiently integrate Node.js or Python services under LAMP architecture? How to efficiently integrate Node.js or Python services under LAMP architecture? Apr 01, 2025 pm 02:48 PM

Many website developers face the problem of integrating Node.js or Python services under the LAMP architecture: the existing LAMP (Linux Apache MySQL PHP) architecture website needs...

How to solve permission issues when using python --version command in Linux terminal? How to solve permission issues when using python --version command in Linux terminal? Apr 02, 2025 am 06:36 AM

Using python in Linux terminal...

Can the Python interpreter be deleted in Linux system? Can the Python interpreter be deleted in Linux system? Apr 02, 2025 am 07:00 AM

Regarding the problem of removing the Python interpreter that comes with Linux systems, many Linux distributions will preinstall the Python interpreter when installed, and it does not use the package manager...

How to configure apscheduler timing task as a service on macOS? How to configure apscheduler timing task as a service on macOS? Apr 01, 2025 pm 06:09 PM

Configure the apscheduler timing task as a service on macOS platform, if you want to configure the apscheduler timing task as a service, similar to ngin...

See all articles