Use Docker To Explore MySQL 5.7.8-rc


Recently I have been using Ansible and Vagrant to test the MySQL 5.7 release candidates but several of you asked about using Docker. The hardest part of this process will be installing Docker on your operating system of choice and that is fairly easy. I am using Ubuntu 14.04 LTS and the installation was a wget command.

Next comes the magic. Docker will download the MySQL 5.7.8-rc image if it is not already loaded locally and then start it.
docker run -p 3306:3306 --name mysql -e MYSQL_ROOT_PASSWORRD=secret -d mysql:5.7.8-rc
The quick translation of the above is that we are telling Docker to set up a container named mysql on port 3306 using a password of secret, run all this as a daemon using MySQL version 5.7.8-rc.

And MySQL 5.7.8-rc is running. But to find it you will have to ask Docker where the server is running.

docker inspect mysql | grep -i ipad
        "IPAddress": "172.17.0.12",
        "SecondaryIPAddresses": null,

Using the local MySQL client, it is easy to connect to the 5.7.8-rc server.

mysql -h 172.17.0.12 -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.8-rc MySQL Community Server (GPL)

Copyright (c) 2000, 2015, 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> \s
--------------
mysql  Ver 14.14 Distrib 5.6.26, for Linux (x86_64) using  EditLine wrapper

Connection id:          2
Current database:       
Current user:           root@172.17.42.1
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ; 
Server version:         5.7.8-rc MySQL Community Server (GPL)
Protocol version:       10
Connection:             172.17.0.12 via TCP/IP
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    utf8
Conn.  characterset:    utf8
TCP port:               3306
Uptime:                 12 sec

Threads: 1  Questions: 5  Slow queries: 0  Opens: 105  Flush tables: 1  Open tables: 98  Queries per second avg: 0.416
--------------

And now there is a instance of 5.7.8-rc to use. Just add in your schemas!

Note that by default 5.7.8 would rather assign a random password and the above ‘force’ of a password is an insecure install (–initialize-insecure).

2 Responses to Use Docker To Explore MySQL 5.7.8-rc

  1. […] PlanetMySQL Voting: Vote UP / Vote DOWN Full article:Use Docker To Explore MySQL 5.7.8-rc […]

  2. Christopher Jacobsen says:

    mispelled MYSQL_ROOT_PASSWORRD ”😉

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s