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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

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)

Hot Topics

Java Tutorial
1663
14
PHP Tutorial
1263
29
C# Tutorial
1236
24
How do containerization technologies (like Docker) affect the importance of Java's platform independence? How do containerization technologies (like Docker) affect the importance of Java's platform independence? Apr 22, 2025 pm 06:49 PM

Containerization technologies such as Docker enhance rather than replace Java's platform independence. 1) Ensure consistency across environments, 2) Manage dependencies, including specific JVM versions, 3) Simplify the deployment process to make Java applications more adaptable and manageable.

Explain the purpose of foreign keys in MySQL. Explain the purpose of foreign keys in MySQL. Apr 25, 2025 am 12:17 AM

In MySQL, the function of foreign keys is to establish the relationship between tables and ensure the consistency and integrity of the data. Foreign keys maintain the effectiveness of data through reference integrity checks and cascading operations. Pay attention to performance optimization and avoid common errors when using them.

Compare and contrast MySQL and MariaDB. Compare and contrast MySQL and MariaDB. Apr 26, 2025 am 12:08 AM

The main difference between MySQL and MariaDB is performance, functionality and license: 1. MySQL is developed by Oracle, and MariaDB is its fork. 2. MariaDB may perform better in high load environments. 3.MariaDB provides more storage engines and functions. 4.MySQL adopts a dual license, and MariaDB is completely open source. The existing infrastructure, performance requirements, functional requirements and license costs should be taken into account when choosing.

SQL vs. MySQL: Clarifying the Relationship Between the Two SQL vs. MySQL: Clarifying the Relationship Between the Two Apr 24, 2025 am 12:02 AM

SQL is a standard language for managing relational databases, while MySQL is a database management system that uses SQL. SQL defines ways to interact with a database, including CRUD operations, while MySQL implements the SQL standard and provides additional features such as stored procedures and triggers.

Linux Operations: Managing Files, Directories, and Permissions Linux Operations: Managing Files, Directories, and Permissions Apr 23, 2025 am 12:19 AM

In Linux, file and directory management uses ls, cd, mkdir, rm, cp, mv commands, and permission management uses chmod, chown, and chgrp commands. 1. File and directory management commands such as ls-l list detailed information, mkdir-p recursively create directories. 2. Permission management commands such as chmod755file set file permissions, chownuserfile changes file owner, and chgrpgroupfile changes file group. These commands are based on file system structure and user and group systems, and operate and control through system calls and metadata.

macOS vs. Linux: Exploring the Differences and Similarities macOS vs. Linux: Exploring the Differences and Similarities Apr 25, 2025 am 12:03 AM

macOSandLinuxbothofferuniquestrengths:macOSprovidesauser-friendlyexperiencewithexcellenthardwareintegration,whileLinuxexcelsinflexibilityandcommunitysupport.macOS,developedbyApple,isknownforitssleekinterfaceandecosystemintegration,whereasLinux,beingo

How to handle high DPI display in C? How to handle high DPI display in C? Apr 28, 2025 pm 09:57 PM

Handling high DPI display in C can be achieved through the following steps: 1) Understand DPI and scaling, use the operating system API to obtain DPI information and adjust the graphics output; 2) Handle cross-platform compatibility, use cross-platform graphics libraries such as SDL or Qt; 3) Perform performance optimization, improve performance through cache, hardware acceleration, and dynamic adjustment of the details level; 4) Solve common problems, such as blurred text and interface elements are too small, and solve by correctly applying DPI scaling.

Why Use Docker? Benefits and Advantages Explained Why Use Docker? Benefits and Advantages Explained Apr 25, 2025 am 12:05 AM

The reason for using Docker is that it provides an efficient, portable and consistent environment to package, distribute, and run applications. 1) Docker is a containerized platform that allows developers to package applications and their dependencies into lightweight, portable containers. 2) It is based on Linux container technology and joint file system to ensure fast startup and efficient operation. 3) Docker supports multi-stage construction, optimizes image size and deployment speed. 4) Using Docker can simplify development and deployment processes, improve efficiency and ensure consistency across environments.

See all articles