Query the MySQL source first docker search mysql You can also go to the official website to view the image tag and select the version you need, otherwise the latest version will be downloaded: https://hub.docker.com/_/mysql/
Switch to a domestic mirror source echo "DOCKER_OPTS=\"\$DOCKER_OPTS --registry-mirror=http://f2d6cb40.m.daocloud.io\"" | sudo tee -a /etc/default/docker Restart Docker sudo service docker restart Try again
Verify
Create a folder dedicated to mysql for docker
Start the mysql container
View the complete container ID cd /var/lib/docker/containers/ View the started container root@deepin-PC:/opt/mysql_docker# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 1f9aa5b79b6a mysql:latest "docker-entrypoint.s…" About a minute ago Up 59 seconds 0.0.0.0:3306->3306/tcp, 33060/tcp mysql Enter mysql (you can replace mysql with the container id) docker exec -it mysql bash Connect to mysql mysql -u root -p 123456 Grant remote access permission mysql> use mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> select host,user from user; +-----------+------------------+ | host | user | +-----------+------------------+ | % | root | | localhost | mysql.infoschema | | localhost | mysql.session | | localhost | mysql.sys | | localhost | root | +-----------+------------------+ 5 rows in set (0.00 sec) mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456'; Query OK, 0 rows affected (0.02 sec) mysql> flush privileges; Query OK, 0 rows affected (0.01 sec) View the docker log: root@deepin-PC:/opt/mysql_docker# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 1f9aa5b79b6a mysql:latest "docker-entrypoint.s…" 6 minutes ago Up 6 minutes 0.0.0.0:3306->3306/tcp, 33060/tcp mysql root@deepin-PC:/opt/mysql_docker# docker logs -f --tail 10 1f9aa5b79b6a 2020-05-11 14:14:30+00:00 [Note] [Entrypoint]: MySQL init process done. Ready for start up. 2020-05-11T14:14:30.702850Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release. 2020-05-11T14:14:30.702952Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.20) started as process 1 2020-05-11T14:14:30.712787Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2020-05-11T14:14:31.064937Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2020-05-11T14:14:31.191792Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock' bind-address: '::' port: 33060 2020-05-11T14:14:31.284386Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. 2020-05-11T14:14:31.292565Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory. 2020-05-11T14:14:31.312549Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.20' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL. Some common operations First check the container id docker ps -a Find the id The following id is the container id Shutdown mysql docker stop id Restart docker restart id start up docker start id **Shut down docker** systemctl stop docker Restart Docker systemctl restart docker The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Analysis of MySQL user management operation examples
>>: Vue+Openlayer batch setting flash point implementation code (based on postrender mechanism)
mysql-5.7.17-winx64 is the latest version of MySQ...
mysql accidentally deleted data Using the delete ...
After installing centos 8, the following error wi...
This article shares the specific code of JavaScri...
In daily work, we sometimes run slow queries to r...
Table of contents Install: 1. Basic use of firewa...
This article shares a blinds special effect imple...
W3Cschool explains it this way The <meta> el...
Table of contents For example: General writing: S...
The reuse of code in vue provides us with mixnis....
Table of contents Install Docker on CentOS 8 1. U...
Effect (source code at the end): accomplish: 1. D...
<br />We have always emphasized semantics in...
Achieve results Code html <div class="css...
I recently used the input size and maxlength attri...