当前位置:网站首页>Docker installing MySQL

Docker installing MySQL

2022-06-24 19:33:00 God__ is__ a__ girl

docker install mysql

  1. Inquire about mysql edition
docker search mysql
  1. Download the version you need
docker pull mysql
  1. Create a mirror instance
docker run --name mysql01  -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -d mysql
  1. Get into mysql example
docker exec -it mysql01 bash
  1. land mysql
mysql -uroot -p
  1. Use to grant permissions
grant all privileges on *.*  to `root`@`%`; 
 This kind of writing is popular on the Internet , In fact, an error will be reported  
GRANT ALL PRIVILEGES ON *.*  ‘root’@’%’ identified by ‘root’ WITH GRANT OPTION;  
  1. Refresh the permissions
flush privileges;
  1. Now you can connect remotely with other connection tools

The overview

[[email protected] docker]# docker pull mysql
......
[[email protected] docker]# docker run --name mysql01  -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -d mysql
1eab0aa45b90b793914265ea0012035d6a6d592f5b9484663d37929353b438f2

[[email protected] docker]# docker exec -it mysql01 bash

[email protected]:/# mysql -uroot -p
Enter password: 

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.19 MySQL Community Server - GPL
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> grant all privileges on *.*  to `root`@`%`; 
Query OK, 0 rows affected (0.01 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
原网站

版权声明
本文为[God__ is__ a__ girl]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202211330506911.html