Lancement de l'image avec : docker run -d -p 3308:3306 --name nomimage \ -e MYSQL_ROOT_PASSWORD=passchoisi nomimage (J'utilise ici le port 3308 car nous avons souvent une instance MySQL qui tourne sur le 3306)
Test de l'accès avec : docker exec -it nomimage bash -> donne accès au bash de l'image.
Connexion au moniteur sql avec mysql -uroot -p .
On est alors invité à taper le mot de passe passchoisi.
➜ mysql git:(main) ✗ docker run -d -p 3308:3306 --name nomimage \
-e MYSQL_ROOT_PASSWORD=passchoisi nomimage
b75db5319e6bbdc0c3521467f5047dcb4fa0856701bbea5ef2af8a337a537038
➜ mysql git:(main) ✗ docker exec -it nomimage bash
root@b75db5319e6b:/# 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.22 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> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
| testdb |
+--------------------+
5 rows in set (0.01 sec)
mysql> use testdb;
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> show tables;
+------------------+
| Tables_in_testdb |
+------------------+
| authorities |
| personne |
+------------------+
2 rows in set (0.00 sec)
mysql>
Content type
Image
Digest
Size
151.6 MB
Last updated
almost 6 years ago
docker pull julienm1/mysql