Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Detailed explanation of using Docker to build externally accessible mysql

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Install mysql 8.0

Docker run-p 63306 mysql:8.0p 3306-e MYSQL_ROOT_PASSWORD=zhaooleemysql-- name zhaooleemysqldb-d mysql:8.0p 53306 name zhaooleemysqldb 3306 maps port 3306 of the docker container to port 63306 of the host-e MYSQL_ROOT_PASSWORD=zhaooleemysql root user login password is zhaooleemysql--name zhaooleemysqldb the name of the new container is zhaooleemysqldbmysql:8.0, and the mysql database version is 8.0.

Enter the container

Docker exec-it zhaooleemysqldb bash

Log into the database

Mysql-uroot-pzhaooleemysql

New users (8.0 is more stringent, remote login with root users is more troublesome, we choose to create a new user)

Create user 'zhaoolee' identified with mysql_native_password by' eelooahzpw'

The new user name of zhaoolee is zhaoolee mysql_native_password password. The encryption method is mysql_native_password eelooahzpw. The password of new user is eelooahzpw.

Add permissions to the new user zhaoolee

Grant all privileges on *. * to 'zhaoolee'

Refresh permissions

Flush privileges

Create a new database

Create database v2fy charset=utf8

The new database is named v2fy

Exit the database

Exit

Exit the docker container

Control + p + Q

Try to connect with Navicat

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report