Skip to content

Instantly share code, notes, and snippets.

@thanoojgithub
Last active June 20, 2020 07:29
Show Gist options
  • Save thanoojgithub/fae323307ab870acd880cf304c5bae91 to your computer and use it in GitHub Desktop.
Save thanoojgithub/fae323307ab870acd880cf304c5bae91 to your computer and use it in GitHub Desktop.
docker-mysql connecting using mysql workbench
PS C:\Users\thanooj> docker pull mysql
PS C:\Users\thanooj> docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
springio/gs-spring-boot-docker latest c8778cb72ef5 5 days ago 527MB
openjdk 8 b190ad78b520 10 days ago 510MB
mysql latest be0dbf01a0f3 11 days ago 541MB
hello-world latest bf756fb1ae65 5 months ago 13.3kB
PS C:\Users\thanooj>
PS C:\Users\thanooj> docker container ls -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d58108aba5fa mysql "docker-entrypoint.s…" 15 minutes ago Up 15 minutes 0.0.0.0:3306->3306/tcp, 33060/tcp mysql_qa
cba3bc8d857f springio/gs-spring-boot-docker "java -jar /app.jar" 5 days ago Exited (143) 5 days ago agitated_kilby
e27849040b31 hello-world "/hello" 2 weeks ago Exited (0) 2 weeks ago angry_ardinghelli
PS C:\Users\thanooj> docker run --name mysql_qa -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -d mysql
PS C:\Users\thanooj> docker ps --filter status=running
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d58108aba5fa mysql "docker-entrypoint.s…" 17 minutes ago Up 17 minutes 0.0.0.0:3306->3306/tcp, 33060/tcp mysql_qa
PS C:\Users\thanooj> docker logs mysql_qa
2020-06-20T06:51:00.769560Z 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-06-20T06:51:00.769797Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.20) initializing of server in progress as process 43
2020-06-20T06:51:00.790541Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-06-20T06:51:03.275773Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-06-20T06:51:08.293410Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2020-06-20T06:51:18.354495Z 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-06-20T06:51:18.354697Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.20) starting as process 90
2020-06-20T06:51:18.402944Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-06-20T06:51:18.909134Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-06-20T06:51:19.179815Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock'
2020-06-20T06:51:19.592301Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2020-06-20T06:51:19.606319Z 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-06-20T06:51:19.676714Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.20' socket: '/var/run/mysqld/mysqld.sock' port: 0 MySQL Community Server - GPL.
Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
2020-06-20T06:51:26.082783Z 10 [System] [MY-013172] [Server] Received SHUTDOWN from user root. Shutting down mysqld (Version: 8.0.20).
2020-06-20T06:51:29.121518Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.20) MySQL Community Server - GPL.
2020-06-20T06:51:30.419523Z 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-06-20T06:51:30.419672Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.20) starting as process 1
2020-06-20T06:51:30.435231Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-06-20T06:51:30.852211Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-06-20T06:51:31.258825Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock' bind-address: '::' port: 33060
2020-06-20T06:51:31.516506Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2020-06-20T06:51:31.534831Z 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-06-20T06:51:31.597436Z 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.
PS C:\Users\thanooj>
PS C:\Users\thanooj> docker exec -it mysql_qa /bin/bash -l
root@d58108aba5fa:/# mysql -uroot -proot
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 16
Server version: 8.0.20 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> select host, user from mysql.user;
+-----------+------------------+
| host | user |
+-----------+------------------+
| % | root |
| localhost | mysql.infoschema |
| localhost | mysql.session |
| localhost | mysql.sys |
| localhost | root |
+-----------+------------------+
5 rows in set (0.00 sec)
mysql>
workbench - test connection successfully!
https://1drv.ms/u/s!AnTUHC77Pa80nhsr24gd6FNkurU1
ref. https://github.com/docker-library/mysql/issues/274
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment